home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / proasm / rexx / ced / proasmsubfile.ced < prev   
Text File  |  1996-04-29  |  4KB  |  110 lines

  1. /*****************************************************************************
  2. *                                                                            *
  3. * ARexx script:          ProAsmSubfile.ced v1.02   for the ProAsm Assembler  *
  4. *                                                                            *
  5. * This script assembles the source given by the first line of the actual     *
  6. * view, if no such source file is given the contents of the actual view will *
  7. * be assembled.                                                              *
  8. *                                                                            *
  9. * The ';$ <filename><LF>' string in the first line defines the source file   *
  10. * which is to be assembled. This enables you to assemble the main file out   *
  11. * of a loaded include file.                                                  *
  12. *                                                                            *
  13. * by Daniel Weber                                                            *
  14. * 28.Jul.93                                                                  *
  15. *                                                                            *
  16. *                                                                            *
  17. * Usage:   ProAsmSubfile.ced                                                 *
  18. *                                                                            *
  19. *                                                                            *
  20. * How to run:                                                                *
  21. *                                                                            *
  22. *  1) Activate the view of the source file.                                  *
  23. *  2) Start this ARexx script via 'Send DOS/ARexx command...'                *
  24. *                                                                            *
  25. *****************************************************************************/
  26.  
  27. editorID = 'CygnusEd'                   /* define editor ID             */
  28.  
  29. OPTIONS RESULTS
  30.  
  31. ADDRESS 'rexx_ced'                      /* get some information from the CED */
  32. status 15
  33. fileadr = result                        /* file address of actual view  */
  34. status 19
  35. name = result                           /* complete path and filename   */
  36. status 57
  37. oldline = result                        /* current line numer           */
  38.  
  39. 'Beg Of File'                           /* ensure file is updated       */
  40.  
  41. status 55                               /* get contents of the first line */
  42. PARSE VAR result ";$ " mainfile '0A'X    /* 'main' file definition...    */
  43.  
  44.  
  45. ADDRESS 'asx_rexx'
  46. FindID editorID':'name
  47. port = result
  48. DO WHILE port~=''
  49.   ADDRESS (''||port)
  50.   EndOfAssembly                         /* quit all open jobs of this source */
  51.   ADDRESS 'asx_rexx'
  52.   FindID editorID':'name
  53.   port = result
  54. END
  55.  
  56.  
  57. BegOfAssembly                           /* begin a new job              */
  58. port = result
  59.  
  60. IF port~='' THEN DO
  61.   ADDRESS (''||port)                    /* ARexx weirdness              */
  62.   DefineID editorID':'name              /* set an ID (optional)         */
  63.  
  64.   IF mainfile~='' THEN Assemble mainfile
  65.                   ELSE Assemble ADDRESS fileadr
  66.  
  67.   PARSE VAR result . errors . warnings . optims optimbytes . codesize . workspace
  68.  
  69.  
  70.   IF errors~=0 THEN DO            /* jump to first error          */
  71.     NextError                           /* get next error               */
  72.     errortxt = result
  73.  
  74.     ADDRESS 'rexx_ced'
  75.     IF errortxt ='' THEN DO
  76.       Okay1 'no more errors'
  77.       exit(0)
  78.     END
  79.  
  80.  
  81.     PARSE VALUE errortxt WITH 1 LineNumber ' : ' ErrorMsg ' in file ' filename
  82.     IF filename ~='' THEN DO
  83.       status 66
  84.       DO numwins= result-1 TO 1 BY -1 UNTIL UPPER(result) = UPPER(filename)
  85.         next view
  86.         status 21
  87.       END
  88.       IF UPPER(result) ~= UPPER(filename) THEN DO
  89.       split view
  90.       open filename
  91.       END
  92.     END
  93.     Jump To Line LineNumber
  94.     Okay1 ErrorMsg
  95.   END
  96.  
  97.  
  98.   ELSE DO
  99.     stat = codesize 'bytes.' '0A'X''optims 'optimizations saved' optimbytes 'bytes' '0A'X
  100.     stat = stat''errors 'Errors,' warnings 'Warnings,' workspace 'bytes of workspace used.'
  101.  
  102.     ADDRESS 'rexx_ced'
  103.     Jump To Line oldline
  104.     Okay1 "File '"name"'"'0A'X"assembled to" stat
  105.   END
  106. END
  107.  
  108. EXIT(0)
  109.  
  110.