home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / text / edit / ttx_m2s / m2s_errlist.ttx < prev    next >
Encoding:
Text File  |  1995-04-09  |  18.1 KB  |  318 lines

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