Pascal Viandier wrote:
In fact, I am converting existing SUN Pascal code to GNU Pascal. Among this, I have a bunch of utility routines which manipulate strings various ways. Some of them have built-in equivalent in gpc rts or gpc unit, but some others have no equivalent.
Apparently, SUN Pascal is not as strict on VAR parameter types as GNU Pascal. So, I have lots of issues compiling the existing code.
An example of my needs is a procedure similar to UpCaseString in gpc unit, which makes each first letter of each word in a string uppercase:
Procedure UpCaseEachWordFirstLetter(Var S : String200);
Where: Type String80 = Varying[200] Of Char;
This procedure accepts strings of any length (SUN Pascal varying strings) up to 200 characters.
The (mostly) equivalent in GPC would be `String (200)'. I usually suggest to use this type since (in contrast to fixed arrays of chars, string types store the current length). String is a schematic type in EP (and thus GPC), so a parameter of type `String' (without given capacity) will accept all `String (n)' types, even for `var' parameters.
Anyway, I tried the conformant array parameter type and it works perfectly well for my needs (even on type STRING(xx) if you mind).
Fine. Yes, it also works for `String (n)', but such `var' parameters can't alter the length of the string.
Frank