Discussion:
Virtual Pascal $define problem
(too old to reply)
Robert AH Prins
2010-11-13 22:57:15 UTC
Permalink
Hi all,

I'm adding a new program to a suite of Virtual Pascal (V2.1 Build 279)
programs and that means adding a bit of code to generate the Copyright
string:

{$define q-h2wiki}

const opt = '/' + {Compiler options in use}

{$ifopt A+} 'A+' {$else} 'A-' {$endif} +
{$ifopt B+} 'B+' {$else} 'B-' {$endif} +
{$ifopt D+} 'D+' {$else} 'D-' {$endif} +
{$ifopt H+} 'H+' {$else} 'H-' {$endif} +
{$ifopt I+} 'I+' {$else} 'I-' {$endif} +
{$ifopt J+} 'J+' {$else} 'J-' {$endif} +
{$ifopt P+} 'P+' {$else} 'P-' {$endif} +
{$ifopt Q+} 'Q+' {$else} 'Q-' {$endif} +
{$ifopt R+} 'R+' {$else} 'R-' {$endif} +
{$ifopt S+} 'S+' {$else} 'S-' {$endif} +
{$ifopt T+} 'T+' {$else} 'T-' {$endif} +
{$ifopt V+} 'V+' {$else} 'V-' {$endif} +
{$ifopt W+} 'W+' {$else} 'W-' {$endif} +
{$ifopt X+} 'X+' {$else} 'X-' {$endif} +
{$ifopt Z+} 'Z+' {$else} 'Z-' {$endif} + '';

const
moi = ' Copyright (C) Robert AH Prins ';

const
copyright: string[71] = moi +

{$ifdef lift} '1987' {$endif}
{$ifdef newlift} '2000' {$endif}
{$ifdef dayform} '1996' {$endif}
{$ifdef h-h2rtf} '1996' {$endif}
{$ifdef dat2txt} '2002' {$endif}
{$ifdef chkdat} '2002' {$endif}
{$ifdef get-aud} '2002' {$endif}
{$ifdef q-h2wiki} '2010' {$endif}
{$ifdef dat2csv} '2003' {$endif} + '-2010' + opt;

begin
writeln(copyright);
end.

The problem is that if I change "q-h2wiki" to what it should be,
"h-h2wiki", the compiler gives me an error '85' Semicolon expected, and
I haven't got a clue as to the why, unless there is some interaction
between the h-h2rtf and h-h2wiki defines.

Can anyone give me a clue?

Thanks,

Robert
--
Robert AH Prins
spamtrap(a)prino(d)org
Chris Burrows
2010-11-13 22:46:52 UTC
Permalink
Post by Robert AH Prins
The problem is that if I change "q-h2wiki" to what it should be,
"h-h2wiki", the compiler gives me an error '85' Semicolon expected, and I
haven't got a clue as to the why, unless there is some interaction between
the h-h2rtf and h-h2wiki defines.
Can anyone give me a clue?
At the risk of stating the obvious: Ensure that you are changing *both*
instances of "q-h2wiki" to "h-h2wiki" in your code otherwise you might end
up with the declaration:

const
copyright: string[71] = moi + + '-2010' + opt;

Regards,
Chris Burrows
CFB Software
http://www.astrobe.com
Marco van de Voort
2010-11-14 12:04:43 UTC
Permalink
["Followup-To:" header set to comp.lang.pascal.borland.]
Post by Robert AH Prins
I'm adding a new program to a suite of Virtual Pascal (V2.1 Build 279)
programs and that means adding a bit of code to generate the Copyright
{$define q-h2wiki}
Does VP really process defines with dashes in it, or does it require (like
e.g. FPC) of defines to be identifiers and regard the rest as comment?

iow {$define q}

Loading...