[fpc-pascal] $IF documentation - missing help

2009-09-15 Thread Graeme Geldenhuys
Hi,

Where is the extended $IF directive documented. The prog.pdf has 2
paragraphs on $if and then referes you to the "conditionals" section.
But the Conditionals section is incomplete.

I look through all these docs...
prog.pdf  ref.pdf  user.pdf

What I am looking for is something I used years ago, but can't find an
example of it now. I can't remember the exact syntax, but is was
something like this:

{$IFDEF FPC $IF Defined(VER2_3) or )
  ...
{$ENDIF}

Due to the mishaps with UnicodeString in FPC 2.3.1, I need to IFDEF some
tiOPF code so that certain code will only work with FPC 2.2.5 and
earlier, and other code will only work with FPC 2.3.1 and greater. How
do I write this?


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] $IF documentation - missing help

2009-09-15 Thread Aleksa Todorovic
Maybe

{$IF Defined(VER2_3) or Defined(VER2_4))
 ...
{$ENDIF}

?


On Tue, Sep 15, 2009 at 13:26, Graeme Geldenhuys
 wrote:
> Hi,
>
> Where is the extended $IF directive documented. The prog.pdf has 2
> paragraphs on $if and then referes you to the "conditionals" section.
> But the Conditionals section is incomplete.
>
> I look through all these docs...
> prog.pdf  ref.pdf  user.pdf
>
> What I am looking for is something I used years ago, but can't find an
> example of it now. I can't remember the exact syntax, but is was
> something like this:
>
> {$IFDEF FPC $IF Defined(VER2_3) or )
>  ...
> {$ENDIF}
>
> Due to the mishaps with UnicodeString in FPC 2.3.1, I need to IFDEF some
> tiOPF code so that certain code will only work with FPC 2.2.5 and
> earlier, and other code will only work with FPC 2.3.1 and greater. How
> do I write this?
>
>
> Regards,
>  - Graeme -
>
> --
> fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
> http://opensoft.homeip.net/fpgui/
>
> ___
> fpc-pascal maillist  -  fpc-pas...@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



-- 
Aleksa Todorovic - Lead Programmer
Eipix Entertainment
http://www.eipix.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] $IF documentation - missing help

2009-09-15 Thread Marco van de Voort
In our previous episode, Aleksa Todorovic said:
> Maybe
> 
> {$IF Defined(VER2_3) or Defined(VER2_4))
> ?...
> {$ENDIF}

How to do this depends on how far back you want to support (1.0.x don't even
support $IF), and far into the future.

Afaik FULL_VERSION was introduced in either 2.2.2 or 2.2.4 to fix at least
the future proof part. If you discount 2.2.0 (and maybe 2.2.2 too, since the
fix was made a few days before 2.2.2 came out and might not be merged) you
could try:

  {$if FPC_FULLVERSION>=20300}  //2.3.4 would be encoded as 020304

  {$endif}


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] $IF documentation - missing help

2009-09-15 Thread Graeme Geldenhuys
Marco van de Voort het geskryf:
> 
> How to do this depends on how far back you want to support (1.0.x don't even
> support $IF), and far into the future.

FPC is free, so I only support up to the previous release. There should
be no excuse not to upgrade (this is very different from Delphi). tiOPF
support Delphi all the way back to D7. I don't do that for FPC.


> Afaik FULL_VERSION was introduced in either 2.2.2 or 2.2.4 to fix at least

 should be FPC_FULLVERSION.

--
$ git log --grep="FPC_FULLVERSION"
commit 05a4a0dadd7d712709d35129345bd06ede45e645
Author: Florian Klaempfl 
Date:   Sun Aug 3 09:31:50 2008 +

+ defined FPC_FULLVERSION as integer constant containing the version,
  release and patch level are always two digits so the version can
  be compared numerically: so 2.2.2 results in 20202, resolves #11568

git-svn-id: http://svn2.freepascal.org:8080/svn/fpc/tr...@11504
3ad0048d-3df
--

I'm not sure what release version that was (r11504).


>   {$if FPC_FULLVERSION>=20300}  //2.3.4 would be encoded as 020304

Excellent, your example is going to work better than VER2_3 or VER2_4
because it will still apply for FPC 2.5 etc...

Luckily I looked this up in the prog.pdf, even though I don't have
$MACROS ON defined, the compiler for some reason never complained about
my usage of FPC_FULLVERSION. Umm, I wonder if this is a bug, or if the
docs are wrong (section 2.2 in prog.pdf)?


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal