The PARSELN.I include file resides on the Kyan Pascal 2.x Utilities Disk 1.
- FUNCTION PARSELINE:STRPOINTER;
Source Code
FUNCTION PARSELINE:STRPOINTER;
VAR BASE,TRAILER,LEADER : STRPOINTER;
LINE : ^STRING127;
X,Y : INTEGER;
BEGIN
LINE:=POINTER(1280);
X:=1; BASE:=NIL; TRAILER:=NIL;
REPEAT
IF LINE^[X] = ' ' THEN X:=X+1
ELSE
BEGIN
NEW(LEADER);
LEADER^.NEXTSTR:=NIL;
IF BASE=NIL THEN BASE:=LEADER
ELSE TRAILER^.NEXTSTR:=LEADER;
TRAILER:=LEADER;
FOR Y := 1 TO 127 DO LEADER^.STRFOUND[Y]:=' ';
Y := 1;
WHILE (ORD(LINE^[X]) <> 155) AND (LINE^[X]<>' ') AND (X < 128) DO
BEGIN
LEADER^.STRFOUND[Y] := LINE^[X];
Y := Y + 1;
X := X + 1
END
END
UNTIL (X>127) OR (ORD(LINE^[X])=155);
PARSELINE:=BASE
END;
No comments:
Post a Comment