Hi
Would it be possible to predefine "ShortString" in GPC? (as "String [255]"). I appreciate that GPC doesn't yet have longstrings so this may seem pointless - but I can't see any harm in having ShortString already defined (at least, in Delphi mode).
Thanks.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/
Prof A Olowofoyeku (The African Chief) wrote:
Would it be possible to predefine "ShortString" in GPC? (as "String [255]"). I appreciate that GPC doesn't yet have longstrings
You mean short strings?
so this may seem pointless - but I can't see any harm in having ShortString already defined (at least, in Delphi mode).
Does Delphi has the `ShortString' identifier? (I suppose to get a short string, independent of the `{$H+/-}' setting which seems reasonable.) If so, the following patch should do it:
--- p/predef.def.orig Fri Apr 22 22:44:07 2005 +++ p/predef.def Thu May 5 23:10:28 2005 @@ -204,6 +204,7 @@ PREDEF_TYPE (Pointer, ptr_type_node, B_D_M_PASCAL) PREDEF_TYPE (PObjectType, gpc_type_PObjectType, GNU_PASCAL) PREDEF_TYPE (String, string_schema_proto_type, NOT_CLASSIC_PASCAL) +PREDEF_TYPE (ShortString, string255_type_node, BORLAND_DELPHI) PREDEF_TYPE (Text, text_type_node, ANY_PASCAL) PREDEF_TYPE (AnyFile, any_file_type_node, GNU_PASCAL) PREDEF_TYPE (TimeStamp, gpc_type_TimeStamp, E_O_PASCAL)
Frank
On 5 May 2005 at 23:12, Frank Heckenbach wrote:
Prof A Olowofoyeku (The African Chief) wrote:
Would it be possible to predefine "ShortString" in GPC? (as "String [255]"). I appreciate that GPC doesn't yet have longstrings
You mean short strings?
No, I meant long strings (AnsiString). GPC already (in a manner of speaking) has short strings, since "String" is treated as a string of 255 chars (at least, that is what the GPC warnings say).
so this may seem pointless - but I can't see any harm in having ShortString already defined (at least, in Delphi mode).
Does Delphi has the `ShortString' identifier?
Yes, it has had it for a long time (since Delphi 2.0 in 1996) ...
(I suppose to get a short string, independent of the `{$H+/-}' setting
Indeed.
If so, the following patch should do it:
--- p/predef.def.orig Fri Apr 22 22:44:07 2005 +++ p/predef.def Thu May 5 23:10:28 2005 @@ -204,6 +204,7 @@
[...]
Will try it over the weekend. Thanks.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/
Prof A Olowofoyeku (The African Chief) wrote:
On 5 May 2005 at 23:12, Frank Heckenbach wrote:
Prof A Olowofoyeku (The African Chief) wrote:
Would it be possible to predefine "ShortString" in GPC? (as "String [255]"). I appreciate that GPC doesn't yet have longstrings
You mean short strings?
No, I meant long strings (AnsiString).
GPC has long strings, up to length 2^31 on 32 bit systems, and 2^63 on 64 bit systems, according to ANSI/ISO Pascal.
So what you mean is the particular string implementation of Delphi which it misnames `AnsiString' (since AFAIK no ANSI standard describes these strings, certainly not the ANSI Pascal standards).
GPC already (in a manner of speaking) has short strings, since "String" is treated as a string of 255 chars (at least, that is what the GPC warnings say).
Of course, GPC allows strings of capacity 255 (or any other smaller capacity than its maximum). So what I meant is the particular string implementation of UCSD and Borland Pascal.
Frank