home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / snma / arexx / addgb.rexx next >
OS/2 REXX Batch file  |  1977-12-31  |  3KB  |  92 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 addgb.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.    This one takes one argument , commandline
  26. */
  27. Assemble:
  28.  
  29.   options RESULTS
  30.   arg cmd
  31.   cmd=strip(cmd,B,'"')            /* strip leading and trailing "s */
  32.   mydir=pragma('d')
  33.   mydir=insert('"',mydir,0)
  34.   mydir=insert('"',mydir,length(mydir))
  35.   CHDIR mydir              /* change the current directory of the snma */
  36.   say "Calling SNMA: ADDGB" cmd
  37.   ADDGB cmd              /* AddGlobal */
  38.   INFO STAT              /* get status information */
  39.   say "Err:" STAT.ERRORS "warn:" STAT.WARNINGS
  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.  
  49.       if STAT.ERRORS > 1 THEN say STAT.ERRORS 'Errors'
  50.       ELSE
  51.           if STAT.ERRORS = 1 THEN say STAT.ERRORS 'Error'
  52.           ELSE say 'No errors'
  53.  
  54.       if STAT.WARNINGS > 1 THEN say STAT.WARNINGS 'Warnings'
  55.       ELSE
  56.           if STAT.WARNINGS = 1 THEN say STAT.WARNINGS 'Warning'
  57.          ELSE say 'No Warnings'
  58.  
  59.       say STAT.CODE 'code hunks. Total ' STAT.CODESIZE 'bytes'
  60.       say STAT.DATA 'data hunks. Total ' STAT.DATASIZE 'bytes'
  61.       say STAT.BSS  'bss hunks. Total ' STAT.BSSSIZE 'bytes'
  62. return    /* end of displayinfo */
  63.  
  64.  
  65. /* following code displays all errors */
  66. DisplayErrors:
  67. enum = 1
  68. if STAT.ERRORS > 0 THEN say "Errors..."
  69. do while enum <= STAT.ERRORS
  70.     GETERR enum STEM UUR
  71.     say '================================================================= '
  72.     say UUR.ERRTXT 'in line' UUR.LINENUM 'of file' UUR.FILENAME
  73.     say UUR.LINETXT
  74.     say insert(' ','^',0,UUR.COLUMN-1)
  75.     enum=enum+1
  76.     end
  77. return /* end of Display Errors */
  78.  
  79. /* following code displays all warnings */
  80. DisplayWarnings:
  81. enum = 1
  82. if STAT.WARNINGS > 0 THEN say "Warnings..."
  83. do while enum <= STAT.WARNINGS
  84.     GETERR enum STEM UUR WARN
  85.     say '================================================================= '
  86.     say UUR.ERRTXT 'in line' UUR.LINENUM 'of file' UUR.FILENAME
  87.     say UUR.LINETXT
  88.     say insert(' ','^',0,UUR.COLUMN-1)
  89.     enum=enum+1
  90.     end
  91. return /* end of DisplayWarnings */
  92.