According to Christian Wendt:
I wondered how to implement the ability to change colours and write text to Standard output - but I think it's nearly impossible to do this within a Unit - the C - Textcolor doesn't work with the fprintf function that is used in the RTS...
Nevertheless I did this. :-) Please have a look at the BPcompat package, available in the `contrib' subdirectory of the GPC distribution.
I wondered wether it would be legal (in sense of portability and compability...) to change the RTS : Textcolor works if you check wether the file passed to writeln is Stdout - when it is you use cprintf (or putch instead of fwrite).
You are right that this is a problem we must think about. In this case I think it increases portability and compatibility to do the changes because otherwise it is impossible to get colors under DOS whereas you can have them with Linux or any other system which provides colors as terminal escape sequences, e.g. according to ANSI.
The question is - would it be legal to do such - you could put in a variable (smth like "GPC_ConsoleOutput") to switch in on/off ?
In the BPcompat package or in newer Alpha releases of GPC, this variable exists and is called `p_directvideo', available as `DirectVideo' if you do `uses CRT'. If it is `true', `writeln' is performed through `cprintf', otherwise through `printf'.
Greetings,
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]