home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 216.lha / RexxArpLib_v2.1 / rexx / PHYZStuff / phyzpub.rexx < prev   
Encoding:
OS/2 REXX Batch file  |  1996-02-15  |  10.0 KB  |  322 lines

  1. /* This is a debug facility for createhost */
  2.  
  3. arg host
  4.  
  5. /* default parameters */
  6.  
  7.  
  8. alternate.1.0 = "Line Spacing: singlespace "
  9. alternate.1.1 = "Line Spacing: normal space" 
  10. alternate.1.2 = "Line Spacing: double space"
  11. count.1 = 0
  12. choices.1 = 3
  13.  
  14. alternate.2.0 = "Journal Style: Physical Review"
  15. alternate.2.1 = "Journal Style: Nuclear Physics" 
  16. choices.2 = 2
  17. count.2 = 0
  18.  
  19. alternate.3.0 = "Chapter Numbering: numbered chapters  "
  20. alternate.3.1 = "Chapter Numbering: unnumbered chapters" 
  21. choices.3 = 2
  22. count.3 = 0
  23.  
  24. alternate.4.0 = "Equation Numbering: sequential"
  25. alternate.4.1 = "Equation Numbering: by chapter" 
  26. count.4 = 0
  27. choices.4 = 2
  28.  
  29. alternate.5.0 = "Title Page Pub-Block: yes"
  30. alternate.5.1 = "Title Page Pub-Block: no " 
  31. choices.5 = 2
  32. count.5 = 0
  33.  
  34. alternate.6.0 = "Paper Type: theory    "
  35. alternate.6.1 = "Paper Type: experiment" 
  36. choices.6 = 2
  37. count.6 = 0
  38.  
  39. alternate.7.0 = "DOE Acknowledgement: yes"
  40. alternate.7.1 = "DOE Acknowledgement: no " 
  41. choices.7 = 2
  42. count.7 = 0
  43.  
  44. alternate.8.0 = "Author Format: Theory    "
  45. alternate.8.1 = "Author Format: Experiment"
  46. choices.8 = 2
  47. count.8 = 0
  48.  
  49. alternate.9.0 = "Abstract: Short     "
  50. alternate.9.1 = "Abstract: Long      "
  51. choices.9 = 2
  52. count.9 = 0
  53.  
  54. datestring = "Automatic"
  55. pubnum = "0000"
  56. titlestring.1 = ""
  57. titlestring.2 = ""
  58. titlestring.3 = ""
  59. titlestring.4 = ""
  60. titlestring.5 = ""
  61.  
  62. author. = ""
  63. institute. = ""
  64. submitstring = "Physical Review D"
  65.  
  66. authornum = 0
  67.  
  68. blanks = copies(' ',46)
  69. text = ""
  70. text=text||"\"||blanks||"     Date:\\"||blanks||"Pubnumber:\\\\\\\\\\\\\\"
  71. text=text||"\\\ Journal:\\   Title:\\        :\\        :\\        :\\        :\\"
  72. text=text||"  Author:\\  Instit:\\        :\\        :\\        :\\"      
  73.  
  74.  
  75.    call MenuWindow(MYHOST,PHYZPUBPORT)
  76.    call WindowText(MYHOST,text)
  77.  
  78.    call AddGadget(MYHOST,25,27,"1"," ","%d%1%d")
  79.    call AddGadget(MYHOST,25,45,"2"," ","%d%1%d")
  80.    call AddGadget(MYHOST,25,63,"3"," ","%d%1%d")
  81.    call AddGadget(MYHOST,25,81,"4"," ","%d%1%d")
  82.    call AddGadget(MYHOST,25,99,"5"," ","%d%1%d")
  83.    call AddGadget(MYHOST,25,118,"6"," ","%d%1%d")
  84.    call AddGadget(MYHOST,25,136,"7"," ","%d%1%d")
  85.    call AddGadget(MYHOST,25,154,"8"," ","%d%1%d")
  86.    call AddGadget(MYHOST,480,27,"DATE",datestring,"%d%1%g",180)
  87.    call AddGadget(myhost,480,45,"PUBNUMBER",pubnum,"%d%1%g",180)
  88.    call AddGadget(myhost,25,172,"9"," ","%d%1%d")
  89.    call AddGadget(myhost,100,200,"JOURNAL"," ","%d%1%g",500)
  90.    call AddGadget(myhost,100,218,"TITLE1"," ","%d%1%g",500)
  91.    call AddGadget(myhost,100,236,"TITLE2"," ","%d%1%g",500)
  92.    call AddGadget(myhost,100,254,"TITLE3"," ","%d%1%g",500)
  93.    call AddGadget(myhost,100,272,"TITLE4"," ","%d%1%g",500)
  94.    call AddGadget(myhost,100,290,"TITLE5"," ","%d%1%g",500)
  95.    call AddGadget(myhost,100,308,"AUTHOR"," ","%d%1%g",500)
  96.    call AddGadget(myhost,100,326,"INST1"," ","%d%1%g",500)
  97.    call AddGadget(myhost,100,344,"INST2"," ","%d%1%g",500)
  98.    call AddGadget(myhost,100,362,"INST3"," ","%d%1%g",500)
  99.    call AddGadget(myhost,100,380,"INST4"," ","%d%1%g",500)
  100.  
  101.    loc  = screenrows() - 30
  102.    call AddGadget(myhost,125,loc,"ANDAUTHOR"," Add Author ","%d%1%d")
  103.    call AddGadget(myhost,325,loc,"CONTINUE"," Write File ","%d%1%d")
  104.  
  105.    call ActivateGadget(myhost,"DATE")
  106.  
  107.    call RefreshMessage(1)
  108.    call RefreshMessage(2)
  109.    call RefreshMessage(3)
  110.    call RefreshMessage(4)
  111.    call RefreshMessage(5)
  112.    call RefreshMessage(6)
  113.    call RefreshMessage(7)
  114.    call RefreshMessage(8)
  115.    call RefreshMessage(9)
  116.  
  117. quitflag = 0
  118.  
  119. do forever
  120.    if quitflag = 1 then leave
  121.    t = waitpkt(PHYZPUBPORT)
  122.    do ff = 1
  123.       p = getpkt(PHYZPUBPORT)
  124.       if c2d(p) = 0 then leave ff
  125.       
  126.       command = getarg(p)
  127.       if command ~= CLOSEWINDOW then name = getarg(p,1)
  128.       t = reply(p, 0)
  129.  
  130.       select
  131.  
  132.            when command = CLOSEWINDOW then do
  133.               call CloseWindow(MYHOST)
  134.               if host = "WB" then queue endcli
  135.               quitflag = 1
  136.            end
  137.            when command = "CONTINUE" then do
  138.               quitflag = 1
  139.               call WriteTexFile('vd0:foo.tex',authornum)
  140.               call CloseWindow(MYHOST)
  141.               if host = "WB" then queue endcli
  142.            end
  143.            when (command < 10) & (command > 0) then do
  144.               count.command = (count.command+1)//choices.command
  145.               call RefreshMessage(command)
  146.            end
  147.            when command = "ANDAUTHOR" then authornum = DoAuthor(authornum)
  148.            when command = "DATE" then call ActivateGadget(myhost,PUBNUMBER)
  149.            when command = "PUBNUMBER" then call ActivateGadget(myhost,JOURNAL)
  150.            when command = "JOURNAL" then call ActivateGadget(myhost,TITLE1)
  151.            when command = "TITLE1" then call ActivateGadget(myhost,TITLE2)
  152.            when command = "TITLE2" then call ActivateGadget(myhost,TITLE3)
  153.            when command = "TITLE3" then call ActivateGadget(myhost,TITLE4)
  154.            when command = "TITLE4" then call ActivateGadget(myhost,TITLE5)
  155.            when command = "TITLE5" then call ActivateGadget(myhost,AUTHOR)
  156.            when command = "AUTHOR" then call ActivateGadget(myhost,INST1)
  157.            when command = "INST1" then call ActivateGadget(myhost,INST2)
  158.            when command = "INST2" then call ActivateGadget(myhost,INST3)
  159.            when command = "INST3" then call ActivateGadget(myhost,INST4)
  160.            when command = "INST4" then call ActivateGadget(myhost,DATE)
  161.            otherwise say command
  162.       end
  163.  
  164.  
  165.    end
  166. end
  167.  
  168.  
  169. exit
  170.  
  171. RefreshMessage:
  172.    arg foo
  173.    count = count.foo
  174.    loctext = foo*18-9 + 25
  175.    string = alternate.foo.count
  176.    call move(myhost,50,loctext)
  177.    call text(myhost,string)
  178. return
  179.  
  180. WriteTexFile:
  181.    arg filename, anumber
  182.  
  183.    pubnum        = GetVar(MYHOST,PHYZPUBPORT,PUBNUMBER)
  184.    datestring    = GetVar(MYHOST,PHYZPUBPORT,DATE)
  185.    journal       = GetVar(MYHOST,PHYZPUBPORT,JOURNAL)
  186.    titlestring.1 = GetVar(MYHOST,PHYZPUBPORT,TITLE1)
  187.    titlestring.2 = GetVar(MYHOST,PHYZPUBPORT,TITLE2)
  188.    titlestring.3 = GetVar(MYHOST,PHYZPUBPORT,TITLE3)
  189.    titlestring.4 = GetVar(MYHOST,PHYZPUBPORT,TITLE4)
  190.    titlestring.5 = GetVar(MYHOST,PHYZPUBPORT,TITLE5)
  191.  
  192.  
  193.    checkfile = open(outfile,filename,'W')
  194.  
  195.    if checkfile = 0 then say "couldn't open file for output"
  196.     
  197.    else do
  198.       call writeln outfile, '%macropackage=phyzzx'
  199.       select
  200.         when count.1 = 0 then call writeln outfile, '\singlespace'
  201.         when count.1 = 2 then call writeln outfile, '\doublespace'
  202.         otherwise nop
  203.       end
  204.       if count.2 = 0 then call writeln outfile, '\PHYSREV'
  205.       if count.3 = 1 then call writeln outfile, '\unnumberedchapters'
  206.       if count.4 = 0 then call writeln outfile, '\sequentialequations'
  207.       if count.5 = 1 then call writeln outfile, '\nopubblock'
  208.       call writeln outfile, '\pubnum{'pubnum'}'
  209.       if datestring ~= "Automatic" then call writeln outfile, '\date={'datestring'}'
  210.       select
  211.         when count.6 = 0 then call writeln outfile, '\pubtype{T}'
  212.         when count.6 = 1 then call writeln outfile, '\pubtype{E}'
  213.         when count.6 = 2 then call writeln outfile, '\pubtype{T/E}'
  214.         otherwise nop
  215.       end
  216.       call writeln outfile, '\titlepage'
  217.       call writeln outfile, '\title{'titlestring.1
  218.       do i = 2 to 5
  219.          if titlestring.i ~=" " then call writeln outfile, titlestring.i
  220.       end
  221.       
  222.       if count.7 = 0 then call writeln outfile, '\doeack}'
  223.       else call writeln outfile, '}'
  224.  
  225.       if authornum > 0 then do
  226.          if count.8 = 0 then do
  227.            do i = 1 to authornum
  228.               if i = 1 then do 
  229.                  call writeln outfile, '\author{'author.1'}'
  230.                  call writeln outfile, '\address{'institute.1.1
  231.                  do j = 2 to 4
  232.                    if institute.1.j ~= "" then call writeln outfile, '\break 'institute.1.j
  233.                  end
  234.                  call writeln outfile, '}'
  235.               end
  236.               else do
  237.                  call writeln outfile, '\andauthor{'author.i'}' 
  238.                  call writeln outfile, '\address{'institute.i.1
  239.                  do j = 2 to 4
  240.                    if institute.i.j ~= "" then call writeln outfile, '\break 'institute.i.j
  241.                  end
  242.                  call writeln outfile, '}'
  243.               end
  244.            end
  245.          end  
  246.          else do 
  247.             call writeln outfile, '\authors'
  248.             call writeln outfile, '\titlestyle{\twelvepoint\caps        }'
  249.             call writeln outfile, '\address{.....,\break ....}'
  250.          end
  251.       end
  252.       if count.9 = 0 then do
  253.          call writeln outfile, '\abstract'
  254.          call writeln outfile, '%abstract body%'
  255.          call writeln outfile, "\submit{" submitstring '}'
  256.       end
  257.       else do
  258.          call writeln outfile, '\submit{' submitstring '}'
  259.          call writeln outfile, '\endpage'
  260.          call writeln outfile, '\abstract'
  261.          call writeln outfile, '%abstract body% '
  262.          call writeln outfile, '\endpage '
  263.       end
  264.    end
  265.     
  266.    call close(outfile)
  267.  
  268.    address command 'e 'filename
  269. return
  270.  
  271. /* MenuWindow.rexx - menu making function */
  272.  
  273. MenuWindow:
  274.  
  275. arg menuhost, menuport
  276. address command runwsh "'x=createhost("menuhost||","||menuport||")'"
  277. mp = openport(menuport)
  278.  
  279. do i = 1 to 2
  280.   address command 'c:WaitForPort 'menuport
  281.   if RC=0 then leave i
  282. end
  283.  
  284. idcmp = 'CLOSEWINDOW+GADGETUP'
  285. flags = 'WINDOWCLOSE+WINDOWDRAG+WINDOWDEPTH+BACKFILL+ACTIVATE'
  286.  
  287. call OpenWindow(menuhost, 0, 0,screencols(),screenrows(), idcmp, flags)
  288.  
  289.    call setapen(menuhost,2)
  290.    call setbpen(menuhost,1)
  291.    call setdrmd(menuhost,JAM2)
  292.  
  293. return 0
  294.  
  295.  
  296. /* GetVar.rexx */
  297.  
  298. GetVar:
  299.   parse arg menuhost, menuport, gadgetname
  300.            call ReadGadget(menuhost,gadgetname)
  301.            t = waitpkt(menuport)
  302.            p = getpkt(menuport)
  303.            string = getarg(p,1)
  304.            t = reply(p,0)
  305.            string = strip(string)
  306. return string
  307.  
  308. /* this gets the author and insitution */
  309.  
  310. DoAuthor:
  311.  
  312. arg whichauthor
  313.  
  314.     whichauthor = whichauthor + 1
  315.     author.whichauthor = GetVar(MYHOST,PHYZPUBPORT,AUTHOR)
  316.     institute.whichauthor.1 = GetVar(MYHOST,PHYZPUBPORT,INST1)
  317.     institute.whichauthor.2 = GetVar(MYHOST,PHYZPUBPORT,INST2)
  318.     institute.whichauthor.3 = GetVar(MYHOST,PHYZPUBPORT,INST3)
  319.     institute.whichauthor.4 = GetVar(MYHOST,PHYZPUBPORT,INST4)
  320.  
  321. return whichauthor
  322.