home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / snma / arexx / shellasm.rexx < prev    next >
OS/2 REXX Batch file  |  1977-12-31  |  2KB  |  85 lines

  1. /*
  2.     This little program assembles file using snma arexx host
  3.     It is quite similar to the Shell interface of SNMA.
  4.     If you want to pass in more argumets enclose them to quotes ("like this").
  5.     Feel free to add more commandline arguments in ASM command to fullfil
  6.     your needs.
  7. */
  8.  
  9. if arg() ~= 1 THEN  DO
  10.     say 'Usage: rx ShellAsm.rexx "CMDLINE"'
  11.     exit    5
  12.     end
  13. arg cmd
  14. address SNMA
  15. call Assemble(cmd)
  16. call DisplayErrors
  17. call DisplayWarnings
  18. call DisplayInfo
  19. 'FREE'                      /* free source, errors...*/
  20. exit
  21.  
  22.  
  23. /*
  24.    Following routine will assemble and display information about it
  25.    Now this one takes one argument , commandline
  26.    "Ram Disk:"
  27. */
  28. Assemble:
  29.  
  30.   options RESULTS
  31.   arg cmd
  32.   cmd=strip(cmd,B,'"')            /* strip leading and trailing "s */
  33.   mydir=pragma('d')
  34.   mydir=insert('"',mydir,0)
  35.   mydir=insert('"',mydir,length(mydir))
  36.   CHDIR mydir              /* change the current directory of the snma */
  37.   say "Calling SNMA: ASM" cmd
  38.   ASM cmd              /* assemble it */
  39.   INFO STAT              /* get status information */
  40. return    /* End of Assemble */
  41.  
  42. DisplayInfo:
  43.  
  44.   say 'Result:' STAT.STATUS'.' STAT.LINES 'lines assembled.'
  45.  
  46.   if STAT.STATUS = 'FAIL' THEN say 'Failure: ' STAT.FAILSTR
  47.      ELSE
  48.     say "Err:" STAT.ERRORS "warn:" STAT.WARNINGS
  49.       say STAT.CODE 'code hunks. Total ' STAT.CODESIZE 'bytes'
  50.       say STAT.DATA 'data hunks. Total ' STAT.DATASIZE 'bytes'
  51.       say STAT.BSS  'bss hunks. Total ' STAT.BSSSIZE 'bytes'
  52. return    /* end of displayinfo */
  53.  
  54.  
  55. /* following code displays all errors */
  56. DisplayErrors:
  57. enum = 1
  58. if STAT.ERRORS > 0 THEN say "Errors..."
  59. do while enum <= STAT.ERRORS
  60.     GETERR enum STEM UUR
  61.     say '================================================================= '
  62.     say UUR.ERRTXT 'in line' UUR.LINENUM 'of file' UUR.FILENAME
  63.     say UUR.LINETXT
  64.     if UUR.COLUMN > 0    then
  65.        say insert(' ','^',0,UUR.COLUMN-1)
  66.     else
  67.        say '^'
  68.     enum=enum+1
  69.     end
  70. return /* end of Display Errors */
  71.  
  72. /* following code displays all warnings */
  73. DisplayWarnings:
  74. enum = 1
  75. if STAT.WARNINGS > 0 THEN say "Warnings..."
  76. do while enum <= STAT.WARNINGS
  77.     GETERR enum STEM UUR WARN
  78.     say '================================================================= '
  79.     say UUR.ERRTXT 'in line' UUR.LINENUM 'of file' UUR.FILENAME
  80.     say UUR.LINETXT
  81.     say insert(' ','^',0,UUR.COLUMN-1)
  82.     enum=enum+1
  83.     end
  84. return /* end of DisplayWarnings */
  85.