home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / amigae / e_v3.2a / rexx / ecompile.ged < prev   
Text File  |  2001-03-31  |  3KB  |  102 lines

  1. /* $VER: CompileE.ged v0.5 (8.8.94)
  2.    by Leon Woestenberg (leon@stack.urc.tue.nl)
  3.  
  4.    This is an ARexx script for GoldED (© Dietmar Eilert), and enables
  5.    you to compile E programs from the editor. Just add a menu item,
  6.    and in the 'Command' window select this ARexx script. Also, set
  7.    the output to 'NIL:'. You might as well add keybindings, window
  8.    gadgets, a shortcut key or even API to call this script.
  9.  
  10.    Now just edit your source in the active window, and select the
  11.    menu item (or key, gadget etc.) you added. The compiler will be
  12.    invoked, and feedback will be showed in the status line of the
  13.    active window. If necessary, unsaved changes will be saved first.
  14.    After compilation, the status line will show the result. If there
  15.    was an error, the cursor will jump exactly to the spot of error,
  16.    and the error message of the compiler will be shown in the status
  17.    line. Warnings or unreferences (not both) will also be shown but
  18.    will not jump, nor beep, as this would get annoying very soon.
  19.    Also, cursor slot (bookmark) 9 will contain the spot of trouble.
  20.  
  21. */
  22.  
  23. /* adjust your EC filename here, especially after registering :) */
  24. ec='ECDEMO'
  25.  
  26. OPTIONS RESULTS
  27.  
  28. IF (LEFT(ADDRESS(),6)~="GOLDED") THEN ADDRESS 'GOLDED.1'
  29. 'LOCK CURRENT QUIET'
  30. IF rc THEN EXIT
  31.  
  32. options='ERRBYTE' 'QUIET'
  33.  
  34. 'QUERY ANYTEXT'
  35. IF (result='TRUE') THEN
  36. DO
  37.   'QUERY DOC VAR FILEPATH'
  38.   IF (UPPER(RIGHT(result,2))='.E') THEN
  39.   DO
  40.     'QUERY MODIFY'
  41.     IF (result='TRUE') THEN
  42.     DO
  43.       'REQUEST STATUS="Saving changes..."'
  44.       'SAVE ALL'
  45.     END
  46.     'REQUEST STATUS="Compiling source..."'
  47.     ADDRESS COMMAND ec filepath options '>T:EC_Report'
  48.     errorbyte=rc
  49.     IF errorbyte>0 THEN
  50.     DO
  51.       'FOLD OPEN=TRUE ALL'
  52.       'GOTO UNFOLD=TRUE BYTE=' || errorbyte
  53.       'PING 9'
  54.     END
  55.     IF OPEN(filehandle,'T:EC_Report','Read')~=0 THEN
  56.     DO
  57.       importance=0
  58.       DO WHILE ~EOF(filehandle) & importance~='ERROR'
  59.         lastline=READLN(filehandle)
  60.         /* messages ordered in accending importance */
  61.         IF (INDEX(lastline,'UNREFERENCED:')~=0) & (importance<1) THEN
  62.         DO
  63.           importance=1
  64.           message=lastline
  65.         END
  66.         IF (INDEX(lastline,'WARNING:')~=0) & (importance<2) THEN
  67.         DO
  68.           importance=2
  69.           message=lastline
  70.         END
  71.         IF (INDEX(lastline,'ERROR:')~=0) & (importance<3) THEN
  72.         DO
  73.           importance=3
  74.           message=lastline
  75.         END
  76.         IF (INDEX(lastline,'EC INTERNAL ERROR')~=0) & (importance<4) THEN
  77.         DO
  78.           importance=4
  79.           message=lastline
  80.         END
  81.       END
  82.       ok=CLOSE(filehandle)
  83.       IF importance=0 THEN message='Compilation succesful.'
  84.       IF importance>=3 THEN 'BEEP'
  85.       message=TRANSLATE(message,'''','"')
  86.       'FIX VAR message'
  87.       'REQUEST STATUS="' || message ||'"'
  88.     END
  89.   END
  90.   ELSE
  91.   DO
  92.     'REQUEST STATUS="Source has no .e extension!"'
  93.   END
  94. END
  95. ELSE
  96. DO
  97.   'REQUEST STATUS="Say what?! Try typing some e source first :)"'
  98. END
  99. 'UNLOCK'
  100. EXIT
  101.  
  102.