Gpc not accepting non-standard (?) systax._(re)

Tue, 21 Oct 1997 15:15:37 +0200



richard.kerry@quantel.com wrote:

> Thank you for your help with the C/external problem, I've removed
> 'external' and that part is now happy.
 
Fine! :-)

> Regarding the second problem, concerning a structured constant, or at least
> what seems to be the gpc technique to achieve the effect of a structured
> constant :
> 
> The full chain of defs is as follows :
> 
> const
>   mArgName = 16;
> 
> type
>   ArgType = (OutputFileArg, InputFileArg, OptionsArg);
>   ArgClass = (StringArg, FileArg, NullArg);
>   ArgStatus = (RequiredArg, OptionalArg);
> 
>   ArgName = packed array[1..mArgName] of char;
>   iArgName = 0..mArgName;
> 
>   ArgDef = record
>     name: record
>       txt: ArgName;
>       amin: iArgName;
>       len: iArgName;
>       end;
>     pos: integer;
>     status: ArgStatus;
>     aclass: ArgClass;
>   end;
> 
>   ArgDefTable = array[ArgType] of ArgDef;
> 
> type
>       ArgDefs = ArgDefTable value (
>         (('                ',  1,  0), 0, OptionalArg, NullArg),
>         (('Output_File     ',  1, 11), 2, OptionalArg, FileArg),
>         ... );
> 
> var
>       kludge  : ArgDefs ;
> I hope this is sufficient for you to sort out my problem. It compiled
> successfully under gpc-970824 but fails under 971001.
 
I think this is a form of the known problem. I'm surprised it did
compile under gpc-970824 (I don't have this version here to check).

Anyway, what you could do (until this problem is solved which might
take some time) is to declare the constant values not with the type
but rather with the variable(s). Though structured constants do not
yet work completely like ISO requires, I guess your example should
work. Try something like:

[types until ArgDefTable, no type ArgDefs]

var
  kludge : ArgDefTable value (...);

Of course, if you have multiple such variables, you have to do
this multiple times, which is not so nice. There could be a
possible "dirty" solution using the preprocessor, something like:

{$define ArgDefs ArgDefTable value (...)}

var
  klugde : ArgDefs;

-- 
Frank Heckenbach, Erlangen, Germany
heckenb@mi.uni-erlangen.de
http://home.pages.de/~fjf/links.htm


Frank Heckenbach (heckenb@mi.uni-erlangen.de)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es