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

  1. /*****************************************************************************
  2. *                                                                            *
  3. * ARexx script:              ProAsm.edge v1.02     for the ProAsm Assembler  *
  4. *                                                                            *
  5. * This script assembles the source in the actual window of the Edge using    *
  6. * the ProAsm assembler and the ASX user interface.                           *
  7. * Please note that the source code in this window will be saved before       *
  8. * assembly.                                                                  *
  9. *                                                                            *
  10. * by Daniel Weber                                                            *
  11. * 31.Dec.93                                                                  *
  12. *                                                                            *
  13. *                                                                            *
  14. * Usage:   ProAsm.edge                                                       *
  15. *                                                                            *
  16. *                                                                            *
  17. * How to run:                                                                *
  18. *                                                                            *
  19. *  1)  Activate the view of the source file.                                 *
  20. *  2a) Start this ARexx script via 'Send DOS/ARexx command...' (or somesuch) *
  21. *  2b) You may put it into your Keyboard file, Menu file, etc. as:           *
  22. *      RX SYNC rexx:edge/ProAsm.edge.                                        *
  23. *  3)  Use 'GoToError show' to open the ErrorList window of Edge.            *
  24. *                                                                            *
  25. *****************************************************************************/
  26.  
  27. editorID = 'Edge'                       /* define editor ID             */
  28.  
  29. OPTIONS RESULTS
  30. EdgePort = ADDRESS()
  31.  
  32. ADDRESS (''||EdgePort)                  /* get some information from the EDGE */
  33.  
  34.  
  35. GetENVVar _FE_DosName            /* full file name               */
  36. fullname = result
  37.  
  38.  
  39. ADDRESS 'asx_rexx'
  40. FindID editorID':'fullname
  41. port = result
  42. DO WHILE port~=''
  43.   ADDRESS (''||port)
  44.   EndOfAssembly                         /* quit all open jobs of this source */
  45.   ADDRESS 'asx_rexx'
  46.   FindID editorID':'fullname
  47.   port = result
  48. END
  49.  
  50.  
  51. /**
  52.  ** start assembly porcess...
  53.  **/
  54.  
  55. BegOfAssembly                           /* begin a new job              */
  56. port = result
  57.  
  58. IF port~='' THEN DO
  59.   ADDRESS (''||edgeport)                /* ARexx weirdness              */
  60.   GetENVVar _FE_BackDir
  61.   backdir = result
  62.   IF backdir = '' THEN backdir = 'ram:'
  63.   GetENVVar _FE_Name
  64.   name = result
  65.   GetENVVar _FE_Changes
  66.   IF result~=0 THEN DO
  67.     RequestChoice title """ProAsm Message...""" """Changes made.\010Save source before assembly?"""
  68.     IF RC = 0 THEN Save
  69.   END
  70.   SaveAs backdir||'asx_'||RIGHT(port,8)||name FORCE NOBACKUP NOICON
  71.   ClearErr                              /* clear error list             */
  72.   PutENVVar _FE_DosName fullname    /* reset name...                */
  73.  
  74.   /* assemble */
  75.   ADDRESS (''||port)
  76.   DefineID editorID':'fullname          /* set an ID (optional)         */
  77.   Assemble backdir||'asx_edge_'||name
  78.   PARSE VAR result . errors . warnings . optims optimbytes . codesize . workspace
  79.  
  80.   stat = 'File 'fullname' assembled to '
  81.   stat = stat''codesize 'bytes.\010'optims 'optimizations saved' optimbytes 'bytes\010'
  82.   stat = stat''errors 'Errors,' warnings 'Warnings,' workspace 'bytes of workspace used.'
  83.   ADDRESS (''||edgeport)
  84.   RequestNotify title """ProAsm Message..."""  ""stat""
  85.  
  86.   /* copy all error messages to edge */
  87.   IF errors ~= 0 THEN DO
  88.     ADDRESS (''||port)
  89.     NextError
  90.     errortext = result
  91.     DO WHILE errortext ~=''
  92.       /* PARSE VALUE errortext WITH 1 LineNumber '.' Column ' : ' ErrorMsg ' in file ' filename */
  93.       PARSE VALUE errortext WITH 1 LineNumber ' : ' ErrorMsg
  94.       Column = 0
  95.       ADDRESS (''||edgeport)
  96.       AddErr LineNumber Column """"ErrorMsg""""
  97.       ADDRESS (''||port)
  98.       NextError
  99.       errortext = result
  100.     END
  101.     ADDRESS (''||edgeport)
  102.     GoToError show  
  103.   END
  104.  
  105.   ADDRESS (''||port)
  106.   EndOfAssembly
  107. END
  108.  
  109. EXIT(0)
  110.  
  111.