On Thursday, May 31, 2012 3:17:38 PM UTC+2, Rainer Weikusat wrote:
> Thomas Mertes writes:
> > I KNOW how to write a buffering layer, but i prefer to use the FILE
> > implementation that comes with the C library, when it is possible to
> > do so.
>
> It isn't possible *except* if you hijack a sufficiently portable 'FILE
> implementation' from a suitable place and include that with your code.
This portable 'FILE implementation' will not fit to external
libraries. A foreign function from an external library will probably
use FILE * parameters from <stdio.h>. Representing files from the
portable 'FILE implementation' as FILE * parameters from <stdio.h>
will probably need much more 'poking around inside the internal
parts of the <stdio.h> FILE facility'. Not every library is open
source and it makes no sense to rewrite every external library,
so that it fits to the portable 'FILE implementation'. There are
definite advantages in using the FILE implementation from <stdio.h>.
Only one experimental file function uses internal information from
the FILE struct. This experimental function is currently only used
in a private test program (which is not released) All other functions
don't use any internal part from the FILE implementation. Before
removing the experimental state of this function I plan to add tests
to the chk... programs, which will check the correct behaviour.
The chk... programs check the correct behaviour of the Seed7
interpreter, compiler and runtime library. Currently the chk...
programs contain 38881 lines of code.
> [...]
>
> > BTW.: Seed7 can be easily ported to a lot of platforms. It is
> > designed to be portable.
>
> Some parts of it, presumably, ...
Seed7 is ported as a whole, not part by part. When it is compiled
there are feature tests, which explore the properties of the C
compiler and its libraries. The code is adjusted with macros to
different platforms.
> except that I feel inclined to take this
> statement with a sizeable barrel of salt: ...
Is is not good for health to consume that much salt.
> Since you quite apparently
> don't even understand
You have no clue what I understand. Please soften your language.
> why 'poking around inside the internal parts of
> some kind of "abstract" facility' ...
"Abstact" facility is exaggerated.
In all classic <stdio.h> headers the FILE struct was not an
abstract facility. It was always defined with all its elements.
This elements and the getc macro were even documented in manuals,
but with the hint, that the elements and the macros were
implementation dependend and that your implementation will probably
use different elements and different macros definitions. Writing
the FILE struct elements in <stdio.h> was absolutely necessary,
since getc was implemented as macro. Nowerdays OO concepts like
abstraction are more familiar, but this does not change history.
> is a problem *for users of your
> code* ...
As I said the code is tested with 38881 lines in test programs.
If you ever tried Seed7 you would know that.
> there's no reason to assume that you aren't doing this
> everywhere consciously were you believe that it 'saves work' and
> presumably, unconciously all over the place as well.
You sound like SCO. You believe that there is something...
> And there is, as I also already wrote, nothing wrong with
> that. It just means that you're implementation isn't fit for practical
> use except in very controlled situations.
The situation is controlled with feature tests before the
compilation starts and with check programs after the
compilation was finished.