home *** CD-ROM | disk | FTP | other *** search
- /* TurboText AREXX Macro for M2Sprint Modula-2 Error Search */
- /* Version 1.0, 4 April 95 by J. E. Gilpin */
- /*
- $VER: TTX_M2S_ErrList 1.0 (04.04.95)
- */
-
- /*************************************************************************/
- /* Tell ARexx to request a results string from external commands. */
- /*-----------------------------------------------------------------------*/
- OPTIONS RESULTS
-
- /*************************************************************************/
- /* The M2Sprint Compiler creates an error log in the T: directory if any */
- /* errors are detected during program compilation. Check for the presence*/
- /* of the error log. If "T:M2.errorlog" isn't found, issue an error */
- /* message and exit the macro. If the error log is present, attempt to */
- /* open it. Exit with an error message if unsuccessful. */
- /*-----------------------------------------------------------------------*/
- IF ~EXISTS("T:M2.errorlog") THEN DO
- SetStatusBar "Error Log Not Present"
- EXIT
- END
- IF ~OPEN("ErrorLog","T:M2.errorlog","APPEND") THEN DO
- SetStatusBar "Can't open Error Log"
- EXIT
- END
-
- /*************************************************************************/
- /* Use the TurboText Command "GetFilePath" to get the complete file path */
- /* and name of the program currently loaded in the editor. */
- /*-----------------------------------------------------------------------*/
- GetFilePath
- Name=RESULT
-
- /*************************************************************************/
- /* The first byte of the M2S Compiler error log is set to a value of 0 */
- /* by the Compiler Macro and is used as a position marker by this macro. */
- /* Each time this macro is called, the next error is displayed and the */
- /* first byte of the error log is incremented. If the error count */
- /* exceeds 250, this macro won't work properly. (Reasonable limitation?) */
- /*-----------------------------------------------------------------------*/
- /* The M2S error log contains the original program filename beginning at */
- /* the second byte (position 1). Read the filename at the beginning of */
- /* the log and compare it to the program filename. If the names match, */
- /* it is a valid error log for the current program. If the names don't */
- /* match, issue an error message and exit this macro. */
- /*-----------------------------------------------------------------------*/
- Position=1 /* Initialize Position and Logname */
- LogName='' /* variables. */
- DO WHILE ~EOF("ErrorLog") /* Don't read past end of file. */
- CALL SEEK("ErrorLog",Position,"B") /* Move to next char position. */
- Character=READCH("ErrorLog",1) /* Assign next char to variable. */
- IF C2D(Character)=0 THEN LEAVE /* Check for end of file name. */
- LogName=LogName||Character /* Concatenate name & next char. */
- Position=Position+1 /* Increment char position count. */
- END /* Repeat til EOF or end of text(0) */
- IF EOF("ErrorLog") THEN SIGNAL Depart /* If EOF was reached, exit Macro */
- FileLength=SEEK("ErrorLog",0,"E") /* If filelength > 1518, err count */
- IF (FileLength-Position)>1518 THEN SIGNAL Depart /* exceeds capacity(250)*/
- IF ~(Name=LogName) THEN SIGNAL Depart /* IF names don't match exit Macro.*/
-
- /*************************************************************************/
- /* Move to the beginning of the error log and read the value of the */
- /* position marker from the first byte. Calculate the actual location of */
- /* next error record and move to that location in the error log. */
- /*-----------------------------------------------------------------------*/
- IF ~(SEEK("ErrorLog",0,"B")=0) THEN SIGNAL Depart /* Move to 1st byte. */
- Offset=C2D(READCH("ErrorLog",1)) /* Read the byte. */
- Location=(Offset*6)+Position+1 /* Calculate location */
- IF ~(Location<FileLength) THEN SIGNAL Depart /* of error record. */
- Offset=Offset+1 /* Increment err count.*/
- IF ~(SEEK("ErrorLog",Location,"B")=Location) THEN SIGNAL Depart
-
- /*************************************************************************/
- /* Read the position and error number from the next error record. The */
- /* first 2 bytes contain the line number of the error, the next 2 bytes */
- /* the column number and the final 2 bytes the error number. */
- /*-----------------------------------------------------------------------*/
- HiByte=C2D(READCH("ErrorLog",1)) /* Get upper byte value.(bits 8-15)*/
- Call CheckEnd /* Check for last err or EOF. */
- LowByte=C2D(READCH("ErrorLog",1)) /* Get lower byte value.(bits 0-7) */
- IF EOF("ErrorLog") THEN SIGNAL Depart /* If end of file, exit to err msg.*/
- Line=(HiByte*256)+LowByte+1 /* Calculate 16 bit line number. */
-
- HiByte=C2D(READCH("ErrorLog",1)) /* Get upper byte value.(bits 8-15)*/
- IF EOF("ErrorLog") THEN SIGNAL Depart /* If end of file, exit to err msg.*/
- LowByte=C2D(READCH("ErrorLog",1)) /* Get lower byte value.(bits 0-7) */
- IF EOF("ErrorLog") THEN SIGNAL Depart /* If end of file, exit to err msg.*/
- Column=(HiByte*256)+LowByte+1 /* Calculate 16 bit column number. */
- IF (Column>255) THEN Column=1
-
- HiByte=C2D(READCH("ErrorLog",1)) /* Get upper byte value.(bits 8-15)*/
- Call CheckEnd /* Check for last err or EOF. */
- LowByte=C2D(READCH("ErrorLog",1)) /* Get lower byte value.(bits 0-7) */
- IF EOF("ErrorLog") THEN SIGNAL Depart /* If end of file, exit to err msg.*/
- Err=(HiByte*256)+LowByte /* Calculate 16 bit error number. */
-
- /*************************************************************************/
- /* Move to the beginning of the error log and write the incremented */
- /* position marker (error record offset) to the first byte of the log. */
- /*-----------------------------------------------------------------------*/
- IF ~(SEEK("ErrorLog",0,"B")=0) THEN SIGNAL Depart
- IF ~(WRITECH("ErrorLog",D2C(OffSet))=1) THEN SIGNAL Depart
-
- /*************************************************************************/
- /* Call the "GetErrMessage" routine to obtain the error message and */
- /* display it in the status bar of the TurboText document. Move the */
- /* cursor to the location of the error, close the error log and exit */
- /* this Macro. THE END! */
- /*-----------------------------------------------------------------------*/
- CALL GetErrMessage
- SetStatusBar Message
- Move FOLDS Line Column
- CALL CLOSE(ErrorLog)
- EXIT
-
- /*************************************************************************/
- /* The "CheckEnd" routine checks for last error record and end of file. */
- /* Determine if the current error record is the last. If so, write a */
- /* message in the TurboText status bar and reset the error count. */
- /*-----------------------------------------------------------------------*/
- CheckEnd:
- IF (HiByte=255)|EOF("ErrorLog") THEN DO
- IF ~(SEEK("ErrorLog",0,"B")=0) THEN SIGNAL Depart
- IF ~(WRITECH("ErrorLog",D2C(0))=1) THEN SIGNAL Depart
- SetStatusBar "End of Error List, Returning to Start"
- EXIT
- END
- RETURN
-
- /*************************************************************************/
- /* Exit the macro with and error message if something went wrong. */
- /*-----------------------------------------------------------------------*/
- Depart:
- CALL CLOSE(ErrorLog)
- SetStatusBar "Invalid Error Log"
- EXIT
-
- /*************************************************************************/
- /* Get the actual message text to display in the TurboText status bar. */
- /* Some error messages are abbreviated or truncated to fit in the bar. */
- /*-----------------------------------------------------------------------*/
- GetErrMessage:
- SELECT
- WHEN Err=10 THEN Message="10 identifier expected"
- WHEN Err=11 THEN Message="11 , comma expected"
- WHEN Err=12 THEN Message="12 ; semicolon expected"
- WHEN Err=13 THEN Message="13 : colon expected"
- WHEN Err=14 THEN Message="14 . period expected"
- WHEN Err=15 THEN Message="15 ) right parenthesis expected"
- WHEN Err=16 THEN Message="16 ] right bracket expected"
- WHEN Err=17 THEN Message="17 } right brace expected"
- WHEN Err=18 THEN Message="18 = equal sign expected"
- WHEN Err=19 THEN Message="19 := assignment expected"
- WHEN Err=20 THEN Message="20 END expected"
- WHEN Err=21 THEN Message="21 .. ellipsis expected"
- WHEN Err=22 THEN Message="22 ( left parenthesis expected"
- WHEN Err=23 THEN Message="23 OF expected"
- WHEN Err=24 THEN Message="24 TO expected"
- WHEN Err=25 THEN Message="25 DO expected"
- WHEN Err=26 THEN Message="26 UNTIL expected"
- WHEN Err=27 THEN Message="27 THEN expected"
- WHEN Err=28 THEN Message="28 MODULE expected"
- WHEN Err=29 THEN Message="29 illegal digit, or number too large"
- WHEN Err=30 THEN Message="30 IMPORT expected"
- WHEN Err=31 THEN Message="31 factor starts with illegal symbol"
- WHEN Err=32 THEN Message="32 identifier, (, or [ expected"
- WHEN Err=33 THEN Message="33 identifier,ARRAY,RECORD,SET,POINTER,PROCEDURE,( or [ expected"
- WHEN Err=34 THEN Message="34 type followed by illegal symbol"
- WHEN Err=35 THEN Message="35 stmnt. starts with illegal symbol"
- WHEN Err=36 THEN Message="36 illegal symbol follows declaration"
- WHEN Err=37 THEN Message="37 stmnt. part illegal in DEFINITION"
- WHEN Err=38 THEN Message="38 export illegal in IMPLEMENTATION module"
- WHEN Err=39 THEN Message="39 EXIT not inside a LOOP construct"
- WHEN Err=40 THEN Message="40 illegal character in number"
- WHEN Err=41 THEN Message="41 number too large"
- WHEN Err=42 THEN Message="42 comment without closing *)"
- WHEN Err=44 THEN Message="44 expression w/constant operands only"
- WHEN Err=45 THEN Message="45 control character within string (cannot exceed one line)"
- WHEN Err=50 THEN Message="50 identifier not declared or visible"
- WHEN Err=51 THEN Message="51 object should be a constant"
- WHEN Err=52 THEN Message="52 object should be a type"
- WHEN Err=53 THEN Message="53 object should be a variable"
- WHEN Err=54 THEN Message="54 object should be a procedure"
- WHEN Err=55 THEN Message="55 object should be a module"
- WHEN Err=56 THEN Message="56 type should be a subrange"
- WHEN Err=57 THEN Message="57 type should be a record"
- WHEN Err=58 THEN Message="58 type should be an array"
- WHEN Err=59 THEN Message="59 type should be a set"
- WHEN Err=60 THEN Message="60 illegal base type of set"
- WHEN Err=61 THEN Message="61 incompatible CASE label or subrange bound"
- WHEN Err=62 THEN Message="62 CASE label already defined"
- WHEN Err=63 THEN Message="63 low bound > high bound"
- WHEN Err=64 THEN Message="64 too many parameters specified"
- WHEN Err=65 THEN Message="65 more parameters expected"
- WHEN Err=66 THEN Message="66 more parameters in IMP than in DEF"
- WHEN Err=67 THEN Message="67 mismatched IMP & DEF parameters"
- WHEN Err=68 THEN Message="68 mismatch between VAR specifications"
- WHEN Err=69 THEN Message="69 mismatched parameter type specs."
- WHEN Err=70 THEN Message="70 more parameters in DEF than in IMP"
- WHEN Err=71 THEN Message="71 mismatched result type specs."
- WHEN Err=72 THEN Message="72 DEF proc. returns val, but not IMP"
- WHEN Err=73 THEN Message="73 DEF proc. has params, but not IMP"
- WHEN Err=75 THEN Message="75 illegal control variable in FOR"
- WHEN Err=76 THEN Message="76 procedure call returns a value"
- WHEN Err=77 THEN Message="77 mismatched heading& end identifiers"
- WHEN Err=78 THEN Message="78 type already declared in DEFINITION"
- WHEN Err=79 THEN Message="79 imported module not found"
- WHEN Err=80 THEN Message="80 unsatisfied export list entry"
- WHEN Err=81 THEN Message="81 illegal type of procedure result"
- WHEN Err=82 THEN Message="82 illegal base type of subrange"
- WHEN Err=83 THEN Message="83 illegal type of CASE expression"
- WHEN Err=84 THEN Message="84 symbol file not written (disk full?)"
- WHEN Err=85 THEN Message="85 imported symbol files keys mismatch"
- WHEN Err=86 THEN Message="86 error in format of symbol file"
- WHEN Err=87 THEN Message="87 unresolved pointer type in block"
- WHEN Err=88 THEN Message="88 symbol file not successfully opened"
- WHEN Err=89 THEN Message="89 procedure in DEF, but not in IMP"
- WHEN Err=90 THEN Message="90 in {a..b}, if a is constant, b also"
- WHEN Err=92 THEN Message="92 too many cases (more than 128)"
- WHEN Err=93 THEN Message="93 too many EXIT statements (> than 16)"
- WHEN Err=94 THEN Message="94 index type array must be a subrange"
- WHEN Err=95 THEN Message="95 subrange bound must be < 2^15"
- WHEN Err=96 THEN Message="96 too many global modules"
- WHEN Err=98 THEN Message="98 too many structure elements in DEF"
- WHEN Err=10 THEN Message="100 multiple defs within same scope"
- WHEN Err=107 THEN Message="107 illegal use of module"
- WHEN Err=108 THEN Message="108 constant index out of range"
- WHEN Err=109 THEN Message="109 indexed variable not an array, or index has wrong type"
- WHEN Err=110 THEN Message="110 rec. selector not field identifier"
- WHEN Err=111 THEN Message="111 dereferenced variable not pointer"
- WHEN Err=112 THEN Message="112 illegal type for sign inversion"
- WHEN Err=113 THEN Message="113 type incompatible with NOT (~)"
- WHEN Err=114 THEN Message="114 x IN y; type(x) # basetype(y)"
- WHEN Err=115 THEN Message="115 x IN y; x bad basetype/y not set"
- WHEN Err=116 THEN Message="116 {a..b}; a or b incorrect basetype"
- WHEN Err=117 THEN Message="117 incompatible operand types"
- WHEN Err=118 THEN Message="118 operand type incompatible with *"
- WHEN Err=119 THEN Message="119 operand type incompatible with /"
- WHEN Err=120 THEN Message="120 operand type incomp. with DIV"
- WHEN Err=121 THEN Message="121 operand type incomp. with MOD"
- WHEN Err=122 THEN Message="122 operand type incomp. with AND (&)"
- WHEN Err=123 THEN Message="123 operand type incompatible with +"
- WHEN Err=124 THEN Message="124 operand type incompatible with -"
- WHEN Err=125 THEN Message="125 operand type incompatible with OR"
- WHEN Err=126 THEN Message="126 operand type incomp with relation"
- WHEN Err=127 THEN Message="127 procedure cannot be nested"
- WHEN Err=128 THEN Message="128 procedure return val type mismatch"
- WHEN Err=129 THEN Message="129 procedure parameter type mismatch"
- WHEN Err=130 THEN Message="130 procedure has too few parameters"
- WHEN Err=131 THEN Message="131 procedure has too many parameters"
- WHEN Err=132 THEN Message="132 assigned neg integer to cardinal"
- WHEN Err=133 THEN Message="133 incompatible assignment"
- WHEN Err=134 THEN Message="134 assignment to non-variable"
- WHEN Err=135 THEN Message="135 IF, WHILE, UNTIL requires BOOLEAN"
- WHEN Err=136 THEN Message="136 called object is not a procedure"
- WHEN Err=137 THEN Message="137 invalid VAR parameter for proc."
- WHEN Err=138 THEN Message="138 constant out of subrange bounds"
- WHEN Err=139 THEN Message="139 invalid RETURN type for proc."
- WHEN Err=141 THEN Message="141 step in FOR construct can't be 0"
- WHEN Err=142 THEN Message="142 illegal type of control variable"
- WHEN Err=144 THEN Message="144 wrong param. type for procedure"
- WHEN Err=145 THEN Message="145 parameter must be type identifier"
- WHEN Err=146 THEN Message="146 string too long"
- WHEN Err=147 THEN Message="147 incorrect priority specification"
- WHEN Err=148 THEN Message="148 redefinition of reserved word"
- WHEN Err=149 THEN Message="149 unknown compiler switch"
- WHEN Err=200 THEN Message="200 implementation restriction"
- WHEN Err=201 THEN Message="201 integer too small for sign inversion"
- WHEN Err=202 THEN Message="202 element outside of set range"
- WHEN Err=203 THEN Message="203 overflow in multiplication"
- WHEN Err=204 THEN Message="204 overflow in division"
- WHEN Err=205 THEN Message="205 div. by 0, or modulus with neg."
- WHEN Err=206 THEN Message="206 overflow in addition"
- WHEN Err=207 THEN Message="207 overflow in subtraction"
- WHEN Err=208 THEN Message="208 cardinal value assigned to integer variable too large"
- WHEN Err=209 THEN Message="209 set size too large"
- WHEN Err=210 THEN Message="210 array size too large"
- WHEN Err=211 THEN Message="211 too much data"
- WHEN Err=212 THEN Message="212 assigned string litteral to VAR parameter"
- WHEN Err=214 THEN Message="214 set elements must be constants"
- WHEN Err=215 THEN Message="215 expression too complex (stack overflow)"
- WHEN Err=222 THEN Message="222 output file not open (disk full?)"
- WHEN Err=223 THEN Message="223 output incomplete (disk full?)"
- WHEN Err=224 THEN Message="224 too many external references"
- WHEN Err=225 THEN Message="225 too many strings"
- WHEN Err=226 THEN Message="226 code buffer overflow"
- WHEN Err=227 THEN Message="227 identifier buffer overflow"
- WHEN Err=228 THEN Message="228 relocation buffer overflow"
- WHEN Err=230 THEN Message="230 expression not loadable (implementation restriction)"
- WHEN Err=231 THEN Message="231 expression not addressable (implementation restriction)"
- WHEN Err=232 THEN Message="232 expression not allowed (implementation restriction)"
- WHEN Err=234 THEN Message="234 register reservation error"
- WHEN Err=235 THEN Message="235 illegal selector for const. index or field"
- WHEN Err=236 THEN Message="236 excess nested WITH statements >4"
- WHEN Err=237 THEN Message="237 illegal operand"
- WHEN Err=238 THEN Message="238 illegal size of operand"
- WHEN Err=239 THEN Message="239 type should be LONGREAL"
- WHEN Err=240 THEN Message="240 parameter should be dynamic array"
- WHEN Err=241 THEN Message="241 illegal type for floating-pt operation"
- WHEN Err=244 THEN Message="244 bad floating-point comparison (implementation restriction)"
- WHEN Err=250 THEN Message="250 invalid library spec for INLINE()"
- WHEN Err=251 THEN Message="251 incorrect # of args for INLINE()"
- WHEN Err=252 THEN Message="252 invalid register number for INLINE()"
- WHEN Err=260 THEN Message="260 PROC, VAR or IMPLEMENTATION specified with $I-"
- WHEN Err=261 THEN Message="261 relocation buffer full"
- WHEN Err=262 THEN Message="262 proc. result not 1,2,4 or 8 bytes"
- WHEN Err=269 THEN Message="269 undefined FORWARD procedure body"
- WHEN Err=270 THEN Message="270 opaque type must occupy 4 bytes"
- WHEN Err=271 THEN Message="271 size not multiple of formal size"
- WHEN Err=273 THEN Message="273 write to read-only $S- parameter"
- WHEN Err=274 THEN Message="274 mismatch in module name specs"
- OTHERWISE Message="Unknown Error"
- END
- RETURN
-
- /*------------------------------------------------------------------------*/
-