curses suggestions wanted_(re)
Wed, 6 Aug 1997 19:21:55 +0200 (MET DST)
According to Ken Linder:
>
> While working on a curses (ncurses) interface I have come upon a situation
> whereby I need some directions from potential GPC ncurses users. Certain
> ncurses functions require a PCHAR pointing to a string for the function to
> use. Would you, the potential users, rather pass a string schema instead?
Yes, but this is no real problem (see below).
> Personaly I would like an ncurses lib where I only pass strings when I can.
>
> Any ideas or suggestions?
>
> I could also allow either type of call...
>
> C style:
> addstr(PChar);
>
> GPC style
> gaddstr(String);
In such situations, where the procedure/function does not change the
parameter, you can declare it with a `PChar' parameter. GPC knows what
to do if the user passes a String schema and implicitly passes the address
of the string data instead of the address of the schema.
OTOH if the String is in fact a `Var' parameter (I don't know if such
functions exist in [n]curses), you must decide whether this shall be a
`PChar' or a String schema. In such cases I would prefer to have the
`String' variant as the default and the `PChar' variant as an extensions,
i.e.
C style:
Procedure cfoo ( Var S: pChar );
GPC style:
Procedure foo ( Var S: String );
(* NB: You needn't specify the length of the string in `Var' parameters,
but you must do so for the return value of a function. *)
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 [970714] - http://home.pages.de/~gnu-pascal/ [970125]
Peter Gerwinski (peter@agnes.dida.physik.uni-essen.de)
HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada -
Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es