[fpc-devel]cursory acquaintance with MacOS RTL

Pavel V. Ozerski pavel at insect.mail.iephb.ru
Tue Jun 29 09:38:53 CEST 2004

Hello all,
10 years ago I programmed a little on ThinkPascal therefore could
point to some inconveniences that seem to be reproduced in FPC.

As is known, common file names are not enough in MacOS to comfortable
file access via shell, they need also two hiden extensions, type and
creator. Think pascal didn't allow (at least, I got the flavour
working without manuals) set these extensions by using standard file
types, reset/rewrite etc and gave e.g. 'TEXT' or 'DATA' for ftype
automatically. I see, in current MacOS RTL. But I think, no reason is
here to use only direct API calls. If two writeable typized constants,
Creator:OSType=$522A6368;fileType:= $54455854, will be added into
INTERFACE section, the programmer will be easy change them later.

E.g., as in this sample:

 TC:packed record
  case byte of
   1:(s:array[0..3]of char)

 assign(f,'My File');

I think, this way is not very beautiful but it is not worse than e.g. using
filemode variable to change file access rights.

Also some notes about some ThinkPascal features.

1) Think Pascal doesn't support assign/assignfile procedures. Instead,
it allows to use a file name as a additional parameter for rewrite,
reset or open procedures. I think, a additional unit could be written
that could mimic this behavior.
2) Think Pascal supports get and put procedures and access to file
buffer via ^ operator.

Best regards,
 Pavel                            mailto:pavel at insect.mail.iephb.ru

More information about the fpc-devel mailing list