home *** CD-ROM | disk | FTP | other *** search
- GET "LibHdr"
-
- MANIFEST $(
- infinity = #x7fffffff $);
-
- STATIC $(
- sourceLineCount = 0;
- sourceStream = 0;
- codeStream = 0 $)
-
- LET CopyToLine(line) BE
- $( SelectInput(sourceStream);
- WHILE line>sourceLineCount DO
- $( LET ch = RdCh();
- IF ch=EndStreamCh THEN RETURN;
- IF ch='*n' THEN sourceLineCount := sourceLineCount+1;
- WrCh(ch) $);
- SelectInput(codeStream)
- $)
-
- AND Start() BE
- $( LET codeLineBuffer = GetVec(20);
- LET argv = GetVec(40);
- LET codeCharCount = 0;
- RdArgs("code/A,source/A,to/K", argv, 40);
- codeStream := FindInput(argv!0);
- sourceStream := FindInput(argv!1);
- IF argv!2~=0 THEN SelectOutput(FindOutput(argv!2));
- sourceLineCount := 0;
- SelectInput(codeStream);
- $( LET ch = RdCh();
- codeCharCount := 0;
- WHILE ch~='*n' DO $(
- IF ch=EndStreamCh THEN GOTO Finished;
- codeCharCount := codeCharCount+1;
- codeLineBuffer%codeCharCount := ch;
- ch := RdCh() $);
- codeLineBuffer%0 := 10;
- /*TEST*/IF codeCharCount>10 &
- CompString(codeLineBuffer, "; -- Line ")=0 THEN $(
- LET n = 0;
- FOR i = 11 TO codeCharCount DO $(
- LET ch = codeLineBuffer%i;
- IF ~('0'<=ch<='9') THEN BREAK
- n := n*10+ch-'0' $);
- CopyToLine(n) $)
- /* ELSE $( */
- FOR i = 1 TO codeCharCount DO WrCh(codeLineBuffer%i);
- NewLine() /*$)*/
- $) REPEAT;
- Finished:
- CopyToLine(infinity)
- $)
-