Download TMQ Vol I.ii - tim
Transcript
Volume 1.11 THE MISOSYS QUARTERLY - FALL 1986 Volume Lii RETURN statement in line 6040. If this statement is replaced with a GOTO 60, the program will RUN. If you don't have the original listing here it is. very persnickety about proper completion of FOR-NEXT loops - meaning don't jump out of the scope of the loop. 10 CLEAR 5000:DEFSTR C:DIM C(1): ALLOCATE 1:SW=64 50 OPEN "I",l,"MAGCl/TXT" 60 IF EOF(l) THEN CLOSE:PRINT: PRINT "THE END" :END 70 LINEINPUT#1,C:GOSUB 6000 80 GOTO 60 6000 ' TABLE OF CONTENTS WORDWRAP ROUTINE 6010 IF LEN(C)<=SW THEN PRINT C :C=" :RETURN 6020 FOR YSW TO 1 STEP -l:IF MID$(C,Y,l)" THEN C(l)" "+MID$(C,Y+l):PRINT LEFT$(C,Y-1) ELSE NEXT Y 6030 IF LEN(C(1))>SW THEN CC(l): GOTO 6020 ELSE PRINT c(l) 6040 RETURN NH had another problem with EnhComp. He passed this message along to us via Compuserve. Is it possible that the copy of EnhComp I received doesn't have the -NX directive operational. The README/TXT file that came with the package states -NX was operational with version 2.4. I have tried unsuccessfully to use this -NX directive. The command tried was BC filespec$,,, -NXWD. This format caused the generation of undefined label or symbol during pass #2. Just for fun I used *_NX and the program compiled without errors but the BREAK key is still operational. Right now I'm ignoring this option when compiling and everything else seems fine. It would be nice to know why the -NX directive generates this error message. I admit the program isn't elegant (RETURNing to a GOTO) but the second RETURN statement should be recognized. Here's the solution. Somehow it just seems that the 6000 subroutine has a FOR NEXT loop which is not too cool for EnhComp. First, it appears that if the 1st char is a blank, the FOR loop does not terminate by exhausting the index. This has a tendency to leave a FOR index counter on the stack. I suggest you look at rewriting that loop so it terminates "properly". MIS interpretive BASIC is pretty lax at requiring the .roper termination of FORNEXT loops. For example, a properly terminated loop is: FOR I = IF I GOTO 50 NEXT 1 TO 100: = 10 THEN I = 100: 50 ELSE WHATEVER: I NH took my suggestion and responded, OK Roy, You were right on. The FOR NEXT loop was the problem. I'll just have to remember to terminate properly. EnhComp otherwise has been very easy to use. The Supervisor command (SICMD) makes it very quick to write, compile, and test a program or routine. Finally, my last note to NH: I thought that it might have been that. EnhComp is A Pot Pourri of MISOSYS Products - 66 - Well when I got around to tsting this report, I at first didn't come up with any problem in compiling. I was just about ready to ask for a copy of his compiler so I could see if it was damaged. I then tried another little four liner and discovered that there was indeed a problem input was - but only when keyboard requested via the INPUT or LINEINPUT routines. This is another case where the exact program source one is having trouble with is necessary for analysis. Here's also some more insight into the information which EnhComp displays during compilation. Any having any occurrence where "Undefined label or symbol" errors are output, should be able to provide a little more feedback concerning the error. Here's the BC output of my test four liner. By the way, I captured this output by routing the *PR device to a disk file then compiled with the -PRT switch. Pass #1 Appending SUPPORT subs (0) (1) (2) (3) (4) (10) (11) (16) (17) (19) (20) (21) (22) (28) (29) (30) (33) (34) (40) (45) (46) (47) (71) (88) (89) (144) (145) (158) (173) (178) (227) (229) (13) (14) (24) (27) (43) (44) (95) (97) (179) (193) A Pot Pourri of MISOSYS Products