Oppolzer - Informatik / Stanford Pascal Compiler


Home       Lebenslauf       Schwerpunkte       Kenntnisse       Seminare       Kunden       Projekte       Produkte       Blog       Stanford Pascal       Kontakt

The Stanford Pascal Compiler / Evolution Steps

Back to Compiler main page

Write integer with leading zeroes, if desired (controlled by negative width)

Compiler version: 10.2017

When reworking the compiler listing, there was a need for writing integer values with leading zeroes.

The standard procedure (CSP) WRI so far did nothing, when the width specified was negative; IBMs Pascal/VS compiler does a left-justified write of integer, when negative widths are specified, but IMO leading zeroes is more useful. So I changed WRI on both Windows (PCINT) and on the mainframe so that leading zeroes are written, when a negative width is specified.

In fact, there is a restriction on the mainframe: WRI only writes 12 digits at most; if the width is below -12, spaces are written instead of leading zeroes. With PCINT, the CSP WRI works as designed.

Example:


for I := 1 to MAXERRNR do begin if I in ERRLOG then begin while ( not EOF ( PRD ) ) and ( I > J ) do READLN ( PRD , J , INPLINE ) ; MEMCPY ( ADDR ( ERRMSG ) , ADDR ( INPLINE [ 4 ] ) , 64 ) ; if J = I then begin WRITELN ( '****' : 7 , ' P' , J : - 3 , ': ' , ERRMSG ) ; WRITELN ( LISTING , '****' : 7 , ' P' , J : - 3 , ': ' , ERRMSG ) ; end (* then *) end (* then *) end (* for *)

Back to Compiler main page