According to Frank Heckenbach:
Indeed, I'd like to have something like this in gpc, too. I'm not at all familiar with the internals of "Text" files (or other files) in gpc. (ISTR, it has something to do with "bindable" variables, but I don't know much about those, either.)
[...]
The particular syntax (and other things) BP uses for this is, IMHO, not very nice (it was introduced after the "good days" of Borland, but before the introduction of OOP, which could have simplified things), so I don't vote for copying BP's mechanism. But any way to do such things would be good.
If somebody who knows C wants to implement this for GPC, here are some ideas:
GPC's run time system (RTS) defines a function `_p_write' which is responsible for all output to text files. The C source is in `rts/rts-write.c'.
I already modified this function to call `cprintf' instead of `printf' on the DOS platform if the variable `_p_directvideo' has a nonzero value. This is done through some preprocessor macros PRINTF1, ... PRINTF4, CFWRITE and serves the purpose to make a `CRT' Unit for DOS possible.
If you replace my macro calls by a call to `sprintf' followed by an indirect call to an output function, we've got it. (Note that Pascal allows `chr ( 0 )' characters in Strings.)
Happy hacking,
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201] maintainer GNU Pascal [970420] - http://home.pages.de/~gnu-pascal/ [970125]