[fpc-pascal] Labels

Jean SUZINEAU jean.suzineau at wanadoo.fr
Mon Dec 18 22:28:19 CET 2023


Le 17/12/2023 à 17:47, Adriaan van Os via fpc-pascal a écrit :
> Turbo Pascal (5.5) defines
>
>     label = digit-sequence . 
Are you sure ?
I had a doubt and I had a look in some very old source code from 1990 
made with tp 5.5, it seems you could have letters in labels.

Excerpt of the code:

PROCEDURE EntCh(var col,lin,lmax:byte;var nbre:boolean;var ch:string);

{entr‚e d'une chaŒne de longueur maxi lmax, si nbre=true, on ne peut entrer}

{que des nombres, signes - et + et point d‚cimal ....                      }

LABEL    e00,e01,e02,e03,e04;

VAR      q,cpos,i,v:byte;

          k           :char;

BEGIN   e00:ch:='';

             q :=0;

             cpos:=col;

             gotoXY(col,lin);

             textbackground(7);textcolor(0);

             for i:=1 to lmax do write('_');

             gotoXY(col,lin);goto e02;

         e01:bip;

         e02:k:=readkey;v:=ord(k);

             if ((q>0) and (v=8)) then

             begin

                  cpos:=cpos-1;q:=q-1;

                  gotoXY(cpos,lin);write('_');

                  ch:=left(ch,length(ch)-1);

                  gotoXY(cpos,lin);

                  goto e02;

             end;

             if ((q=0) and (v=13)) then

             begin

                  ch:=k;goto e04;

             end;

             if (v=13) then goto e04;

             case nbre of

             true : if ((v>47)and (v<58)) or (v=46) then

                    goto e03 else goto e01;

             false: if (v>31) then goto e03 else goto e01;

             end; {case nbre of}

         e03:q:=q+1;if (q>lmax) then goto e01;

             write(k);ch:=ch+k;cpos:=cpos+1;goto e02;

         e04:textbackground(0);textcolor(7);

             gotoXY(col,lin);write(ch);write(space(lmax-length(ch)));

END; {procedure EntCh(...)}

{--------------------------------------------------------------------------}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20231218/c9dc45cd/attachment.htm>


More information about the fpc-pascal mailing list