home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / prog / arexx / aztecr.lha / Make.DME < prev    next >
Encoding:
Text File  |  1990-02-22  |  3.4 KB  |  118 lines

  1. /* AREXX:Make.DME        PUBLIC DOMAIN SOFTWARE
  2.  
  3.     Program to interface Aztec C 5.0 with the DME editor,
  4.          a roll-your-own integrated environment.
  5.  
  6.            By     Robert W. Albrecht
  7.              1457 Zion Way
  8.              Ventura CA 93003
  9.  
  10.                How you run the program...
  11.       From within the DME editor type Make from the command line or
  12.       attach it to a menu or keyboard command.
  13.  
  14.            Here is what this program does....
  15.       First CCOPTS is set to "-qfq" and the make program is executed.
  16.  
  17.       The the file AztecC.Err is read, parsed, and sent to a file called
  18.       t:aztecerr.tmp, which contains the real line numbers of all of the
  19.       errors. On the first error DME is instructed to open a new window
  20.       with the file that has the error. For every error DME is instructed
  21.       to go to the line where the error occurs and insert a comment of the
  22.       form /* Oops!!! Line: 1 #4 argument type mismatch */. If there is
  23.       more than one error for a line only the first one will be called out
  24.       in a comment. Finally DME is instructed to go to the first error in
  25.       the file.
  26.  
  27.       When the program is finished it closes t:aztecerr.tmp, deletes
  28.       AztecC.Err and sets CCOPTS back to nothing. If you use some
  29.       CCOPTS you may want to change the program.
  30.  
  31.                Notes...
  32.       You can use the Bug.DME program to go to the next occurance of
  33.       "Oops!!!" in the file you are editing.
  34.  
  35.       After fixing all of the errors in your program you may want to
  36.       use the Clean.DME program to get rid of all of the "Oops" comments.
  37.  
  38. */
  39.  
  40. options failat 6
  41. rc=0
  42. openFlag=0
  43. lineNoOld=-1
  44. linesOut=0
  45. CfileOld=""
  46. Handle.inFile="InputFile"
  47. Handle.outFile="OutputFile"
  48. Name.inFile="AztecC.Err"
  49. Name.outFile="t:aztecerr.tmp"
  50.  
  51. /* run make and look for the error file */
  52. call startup
  53. if ~exists(Name.inFile)
  54.    then call cleanup(rc)
  55.  
  56. openFlag.inFile=open(Handle.inFile,Name.inFile,'R')
  57. if openFlag.inFile=0
  58.    then call cleanup(rc)
  59. openFlag.outFile=open(Handle.outFile,Name.outFile,'W')
  60. if openFlag.outFile=0
  61.    then call cleanup(rc)
  62.  
  63. /* Read all of the strings in the file */
  64. do until eof(Handle.inFile)
  65.    str=readln(Handle.inFile)
  66.    if eof(Handle.inFile)
  67.       then leave
  68.    else do
  69.       parse var str Cfile '>' lineNo ':' colNo ':' Type ':' ErrorNo ':' Message
  70.       if Cfile ~= CfileOld
  71.      then do
  72.      'newwindow newfile ' || Cfile
  73.      CfileOld=Cfile
  74.      call writeln(Handle.outFile,"/* File: " || Cfile || " */")
  75.      end
  76.  
  77.    if lineNo ~= lineNoOld
  78.       then do
  79.      msgLine="/* Oops!!! Line:" lineNo " #" || ErrorNo || " " || Message || " */"
  80.      call writeln(Handle.outFile,msgLine)
  81.      lineNoOld = lineNo
  82.      'goto' LineNo+linesOut
  83.      'insline'
  84.      'first'
  85.      "(/* Oops!!! Line:" lineNo+linesOut || " #" || ErrorNo || " " || Message || " */)"
  86.      linesOut=linesOut+1
  87.      lineNoOld = lineNo
  88.       end
  89.    end
  90. end
  91. call cleanup(rc)
  92.  
  93. /*            CLEANUP
  94.  * This procedure just cleans things up, closes files etc.
  95.  */
  96. cleanup: procedure EXPOSE openFlag.inFile  Name.inFile    Handle.inFile,
  97.               openFlag.outFile Name.outFile Handle.outFile
  98.    arg i
  99.    address COMMAND 'set CCOPTS='
  100.    if openFlag.inFile == 1
  101.       then do
  102.       call close(Handle.inFile)
  103.       address COMMAND 'delete' Name.inFile
  104.       'top'
  105.       'find (Oops!!!)'
  106.       end
  107.    if openFlag.outFile == 1
  108.       then call close(Handle.outFile)
  109.    exit i
  110.  
  111. /*         STARTUP
  112.  * This procedure sets the QuickFix option for Aztec C and then runs make.
  113.  */
  114. startup: procedure
  115.    address COMMAND 'set CCOPTS=-qfq'
  116.    address COMMAND 'make'
  117.    return 1
  118.