[fpc-devel]cursory acquaintance with MacOS RTL
Olle Raab
olle.r at automagika.se
Fri Jul 2 11:15:38 CEST 2004
04-06-29 09.38, skrev Pavel V. Ozerski följande:
> 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.
If it is possible, I will try to add this.
> E.g., as in this sample:
>
> var
> f:file;
> TC:packed record
> case byte of
> 0:(x:OSType);
> 1:(s:array[0..3]of char)
> end;
>
> begin
> TC.s:='MyDt';
> fileType:=TC.x;
> TC.s:='CoOL';
> creator:=TC.x;
> assign(f,'My File');
> reset(f,1);
> ....
>
> 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.
I will probably add this also, as overloaded procedures, to a comming macpas
unit which would be included automatically if mode macpas is used.
> 2) Think Pascal supports get and put procedures and access to file
> buffer via ^ operator.
Is this really used by many programmers ?
Is this standard Pascal ?
Thank you for your opinons/ Olle
More information about the fpc-devel
mailing list