[fpc-pascal]ocrt question

Alex Dingle adingle at crud.net
Tue Jul 1 01:07:03 CEST 2003

On Mon, Jun 30, 2003 at 07:55:25AM +0200, Rainer Hantsch wrote:
> Hi!
> In your situation, I would insert a "virtual screen" between your application
> and execution of ncurses calls. All write opertions should also be stored into
> an array hereby, and when reading, use this array instead of a real read from
> ncurses.
A good idea, this is what I'm already doing, basically, the problem is
that I will have to provide reimplimentations for write and writeln
which is a moderate pain due to the variable number and type of
parameters.  (I'm new to pascal -- the only way I can see of doing
this is with 'array of const' -- is there a better way?)  

> Another way will be some more tricky:
> o Write a translation function which works with a dynamic list. This list
>   is initially empty, so there will be no translation.
> o On program start, write all characters in a loop (always only one character)
>   into position 1/1 on the sreen, then read it back. If the result is
>   different, the original and the read-back value are added to the list of
>   the translation function.
> o After that, proceed as usual with your program, but feed every read-back
>   from screen through the translation routine.
> This way your program should automatically "learn" the translation of ncurses
> and can reverse it, as long as there is noextreme conversion. Keep in mind
> that ncurses is able to translate a graphical character, i.e. a horizontal
> bar, into a normal minus character. In this case, _every_ minus character from
> read-back, including true minuses!!!, would be translated back into a
> graphical horizintal bar!
This is a cool idea, but I'm a bit scared about the possibility of what
you call an "extreme" conversion occuring (this game uses a *lot* of
high ASCII :) )  I suppose it probably wouldn't be too hard to try


More information about the fpc-pascal mailing list