PROGRAM PUTSTRT;

{ Testing the PUTSTR library procedure.

FILE: [22,11]PUTSTRT.PAS
History: J.M.B. 2-Feb-82 created
}



%INCLUDE LB:[22,10]GENTYP2.PAS;
%INCLUDE LB:[22,20]PUTSTR.EXT;

VAR
    INSTR:CH20; {READ-IN STRING}
    ATTSET:CRT_ATTRIBUTE_SET;
    LINE,COLUMN:INTEGER;
    SAVE:BOOLEAN;
    ERASE:BOOLEAN;
    STATUS:INTEGER;
    ISAVE,IERASE:INTEGER;
    IATTS:CHAR;

BEGIN
INSTR:='HI! I am PUTSTRTS   ';
PUTSTR(-2,1,[REVERSE],LOOPHOLE(ADDRESS,REF(INSTR)),20,TRUE,STATUS);
WRITELN('STATUS IS ',STATUS:-7);
IATTS:=CHR(0);
REPEAT
WRITELN('ENTER LINE,COLUMN,ERASE(1/0),SAVE(1/0),STRING:');
READLN(LINE,COLUMN,IERASE,ISAVE); READLN(INSTR);
IF NOT EOF(INPUT) THEN BEGIN
    ERASE:=IERASE=1;
    IF ERASE THEN LINE:=-1*LINE;
    SAVE:=ISAVE=1;
    ATTSET:=LOOPHOLE(CRT_ATTRIBUTE_SET,IATTS);
    IF ORD(IATTS) = 37B THEN IATTS := CHR(0) ELSE IATTS:=SUCC(IATTS);
    PUTSTR(LINE,COLUMN,ATTSET,LOOPHOLE(ADDRESS,REF(INSTR)),20,SAVE,STATUS);
    WRITELN('STATUS IS ',STATUS:-7)
END;
UNTIL EOF(INPUT)
END.
