IP Pascal to Pascal-P6/Pascaline: what has changed? #233
samiam95124
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
IP Pascal to Pascal-P6/Pascaline: what has changed?
Pascal-P6 reached a milestone, which is that it implements everything IP Pascal, created in 1993, implemented. That means that Pascal-P6 can now compile all of the program set of IP Pascal.
So what has changed? Well, the changes are not zero, despite my fervent desires for it to be zero. However, if you use the original files from IP Pascal, the library files, there would only be one change that would not be accomodated.
In IP Pascal:
write(a:0);Meant to output a right padded string at its padded length. In 1980 IP Pascal, there was no such thing as a variable length array allocation, so padded right strings were the ISO 7185 posterior pain. However, in 1993's IP Pascal redesign, variable length arrays could be created and any array could be passed to routines. Thus padded strings became much more useful. In fact, in all of my code, there are only a handful of instances where padded right strings cannot be used[2].
It turns out that specifying a zero width for a string is more useful that you'd a think. The classic example is to output a specified number of spaces:
write(' ':n);Meaning "write n spaces", which could be any number, including 0. It turns out everyone had this same thought, and so the convention of allowing zero fields on strings made it into many Pascal implementations.
Thus in Pascaline it is:
write(a:*);
To output a padded string at length.
Other changes
In old IP Pascal, the library file "stddef" was used to introduce common definitions such as byte, pointer to strings, set of character etc. Apparently earlier me had an aversion to putting such things in the system level of the compiler. Now many built in definitions exist, usually using hungarian notation:
a - array
p - pointer
s - set
So abyte is array of byte, pabyte is pointer to array of bytes, etc. This is all a moot point if you use stddef, but I have no plans to do that. Since most of stddef got incorporated into Pascaline, the net change was:
chrset -> schar
Makes sense no?
The only names not covered by the convention are:
vector - one dimensional array of integer
matrix - two dimensional array of integer
These are obvious common naming conventions for the object at hand. Vector would have been possible in IP Pascal. Matrix not so. Its a two dimensional array that does not specify its x or y size. This was impossible before.
Library names
The old library names were coined off the acronym "lib". The new names are far more descriptive:
strlib -> strings
extlib -> services
Etc. This was especially important with the advent of the joins feature. This means that all qualidents include the library name.
Refer
IP Pascal used "refer" to supress reference errors:
refer(x)
Supressed errors on the use of x. It effectively flagged a reference to the symbol. Hence the name. Its already listed in issues for inclusion to Pascal-P6.
System library
IP Pascal featured system support library that was written itself in Pascal, and was, IMHO, a work of art. It accomodated any OS in a very independent way, and had little or no assembly language or C code. Now it is all written in C and depends on libc. This makes sense, because Pascal-P6 is going whole hog on C integration. C is everywhere. So is libc. It would not matter if libc were not available. There are many portable libc implementations, including my own[1].
I bring this up only because one module, parse, includes a reference to ss_wrterr(), which is a direct write to the console. The reason that was a thing is that, when working with graphical subsystems, being able to bypass the graphics and write directly to the console was useful. I suspect that writes to the error file are the way to do that now, but we will see.
[1] Of which quite a bit of it is in Petit-Ami.
[2] In which case you use pstrings or parameterized variables to get the exact size required.
Beta Was this translation helpful? Give feedback.
All reactions