I think a lot of my initial queries come from not being used to playing with FP enough (yet). A lot of the code I'm porting, is based around my own encapsulating units, classes, and functions. They in turn call the underlying stuff, much like an RTL separates the programmer from the OS I guess. When I did the Virtual Pascal (for OS/2) port of this, I tried to emulate as much of what I was already doing into a set of libraries for VP so I didn't have to change too much of the application code. That worked out quite nicely.
This time, I've decided (almost) to go the other way. FP will most likely be the last tool used for the Pascal version of the code, so I try to look for "native" FP functions that does what I need and then take out all IFDEF <platform> that I can and let FP's RTL handle the differences. The problem is that I seem to need to learn the entire FCL, RTL, etc by heart ... or die from lack of patience
Psuedo code of what I'm used to:
f := OpenFile ('foo.txt', rO | dW);
if (f < 0) then
begin
if (errno = ENOENT) then
f := CreateFile ('foo.txt', rW | DW)
else
DieFatallyAndMakeNoises ('foo.txt', errno);
end
else
.. .. ... ...
So in this particular case, I guess I was looking for a standardized set of error codes, 1 - nnnnnn, that can be used universally between all units, on all platforms, to mean the same thing; to be reported to the user, or the log file, or whatever.
(Sorry if this sounds like incoherent ramblings, I've got 32 browser tabs open and three PDF files trying to make sense of the entire structure
)