Frank Heckenbach wrote:
Scott Moore wrote:
Scott Moore wrote:
UCSD has the form:
close(filename, option)
Where option is a "word":
normal lock purge crunch
Note that a filename (not handle or var file reference) is used, and that "word" as option pretty much requires close to be a compiler built-in statement.
Ugh. So they are not even predefined constants?
Also the filename seems problematic to me. What if several files are opened to the same file name? Then add the problems if directories were changed (as discussed recently in a similar situation). I don't think we want to emulate this ...
I was incorrect. The book calls it a "filename", but I was looking through some old UCSD source programs, and close(file, lock) clearly uses "file" as in "file of text", ie, the file, not its name.
OK, much better then. :-) So except for the 2nd parameter it's the same as in the other dialects I know.
BTW (don't kill me ;-), if someone really wants to use it like this it in GPC, they can use the preprocessor (except it will then accept *anything* for the 2nd parameter).
{$define Close(f, x) Close (f)}
The program wouldn't behave as expected, because the second parameter isn't meaningless, e.g. x=CRUNCH sets the end-of-file to the point of last access. So, I guess, it is better to change UCSD Pascal source code when porting to GPC (or to another Pascal).
Regards,
Adriaan