willett wrote:
Attached is a fairly rigorous test program for Extended Pascal strings. It was written by Tony Heatherington at Prospero Software; Heatherington was a member of the Extended Pascal committee. I have commented-out the 3 Prospero-specific tests.
gpc does well on this test, but fails one syntax test and several runtime ones.
The syntax problem is in using a parameter to define a string capacity. That can be temporarily worked around by substituting (14) for (n) on line 65.
More precisely, it's a semantic, not a syntax problem, but indeed it's a GPC bug. GPC doesn't yet support initialized variables of non-constant size. Removing the `value ...' and doing the assignment in code also works around the problem. (Though indeed the error message does not indicate it's about initialization.)
Most of the runtime errors are generated by a single problem with conformance, regarding string equality. The relevant standard text, 6.8.3.5, is below, after the string test program.
GPC by default does exact string comparisons, without blank padding. To get the (broken IMHO) EP behaviour, one can use --extended-pascal (which requires other changes in the test, such as avoiding to use Word, SetLength etc.), or --no-exact-compare-strings. With this option I get rid of Fail 11 and 12. Then I get a range-check error in this line:
IF x1[j*k..20][1] <> 'k' THEN fail(34);
This is because GPC does not shift the range of string slices to 1..x by default, only in EP mode. Currently we don't have a separate feature options for this, so I tried with --extended-pascal now (removing the non-EP parts). I then get:
actual schema discriminants do not match
in this line:
valueparam(fval,ls2);
Though the text of the message is somewhat misleading, the error (according to strict EP rules) is correct (i.e., the test is not EP compliant), as Length (fval) = 14 and Length (ls2) = 7:
: 6.7.3.2 Value parameters : : If the parameterÂform of the valueÂparameterÂspecification contains a : schemaÂname that denotes the schema denoted by the required : schemaÂidentifier string, then each corresponding actualÂparameter contained : by the activationÂpoint of an activation shall possess a type having an : underlyingÂtype that is a stringÂtype or the charÂtype; it shall be an error : if the values of these underlyingÂtypes, associated with the values denoted : by the actualÂparameters, do not all have the same length.
Fix:
PROCEDURE valueparam(fst1: s20; fst2: s20);
Then I get Fail 71. This test assumes a particular default field width in WriteStr which EP does not guarantee. Fix:
writestr(lstring,i:6,r:7:2,ch,lpac);
Then it passes all tests.
Thanks for running these tests!
Frank