I've ran into a problem compiling separate UNITS using "borland-pascal" style syntax. Essentially individual elements in an ENUM declared in an INTERFACE are not "recognized" by gpc-2.0:
testunit1.pas:
UNIT TestUnit1;
INTERFACE
TYPE Wood = (Oak, Pine, Beech, Teak); Fruit = (Apples, Peaches, Lemons);
CONST Oranges = Teak;
PROCEDURE CheckFruit ( FruitType : Fruit );
IMPLEMENTATION
PROCEDURE CheckFruit ( FruitType : Fruit ); BEGIN CASE FruitType OF Apples : Writeln ('Apples'); Peaches : Writeln ('Peaches'); Lemons : Writeln ('Lemons'); END; END; END.
<gpc -c testunit1.pas> compiles with no errors.
testunit2.pas:
UNIT TestUnit2;
INTERFACE
USES TestUnit1;
PROCEDURE UseFruit;
IMPLEMENTATION
PROCEDURE UseFruit; BEGIN CheckFruit (Apples); CheckFruit (Peaches); CheckFruit (Lemons); CheckFruit (Oranges); END;
END.
<gpc -c testunit2.pas> yields:
testunit2.pas: In function `Usefruit': testunit2.pas:13: undeclared identifier `Apples' (first use this function) testunit2.pas:13: (Each undeclared identifier is reported only once testunit2.pas:13: for each function it appears in.) testunit2.pas:14: undeclared identifier `Peaches' (first use this function) testunit2.pas:15: undeclared identifier `Lemons' (first use this function)
It's interesting that "Oranges" is recognized since it is a const. I assume no "type cast" error is reported since full pascal type/range checking is not as yet implemented.
Does anyone know of a fix or work-around for this? We're trying to port some code still in production and are stuck with a 10 year old compiler from Silicon Valley Software (now defunct).
Thanks; Phil ------------------------------------------------------------------------- Philip A. Robertson phil_robertson@gilbarco.com Gilbarco Inc. F-78 Phone (910) 547-5164 7300 W. Friendly Ave Fax (910) 292-8871 Greensboro, NC 27410 -------------------------------------------------------------------------