[fpc-pascal] How to do conditional compilation with macros
Trying to test for a certain minimum version of FPC. Have got FPC version 2.7.1 [2011/09/17] for i386 on Windows. What am I doing wrong? program conditional; {$mode objfpc}{$H+} uses {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF} Classes; begin //How should I use FPCVULLVERSION in conditional compilation? {$IF $FPCFULLVERSION 20200} writeln('Version newer than 2.2'); //Error: Compile time expression: //Wanted BOOLEAN but got INTEGER at IF or ELSEIF {$ENDIF} //so maybe the IF wants a precooked boolean result //let's try some brackets //Tried to apply Programmer's Guide 2.4 on Compile time expressions: {$MACRO+} {$IF (FPCFULLVERSION 20200)} //Error: Compile time expression Wanted STRING but got INTEGER at //FPCFULLVERSION 20200 writeln('Version newer than 2.2 another try'); {$ENDIF} //adding a $: {$IF ($FPCFULLVERSION 20200)} //Error: Syntax error while parsing a conditional compiling expression writeln('Version newer than 2.2 yet another'); {$ENDIF} end. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to do conditional compilation with macros
On 18.09.2011 13:29, Reinier Olislagers wrote: What am I doing wrong? Additionally to what Marco wrote: You must not use the $ as prefix for the variable if you reference such a compiler define inside an $if or $ifdef. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to do conditional compilation with macros
On 18-9-2011 13:41, Sven Barth wrote: On 18.09.2011 13:29, Reinier Olislagers wrote: What am I doing wrong? Additionally to what Marco wrote: You must not use the $ as prefix for the variable if you reference such a compiler define inside an $if or $ifdef. Regards, Sven Thanks guys - reading manuals is not always my strong point ;) This works: program conditional; {$mode objfpc}{$H+} begin {$IF FPC_FULLVERSION 20200} //apparently FPC_FULLVERSION was introduced //in FPC 2.2.4 though... //http://delphi.wikia.com/wiki/FreePascal_detection_and_versioning writeln('Version newer than 2.2'); {$ENDIF} end. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to do conditional compilation with macros
On Sun, Sep 18, 2011 at 8:35 AM, Marco van de Voort mar...@stack.nl wrote: In our previous episode, Reinier Olislagers said: Have got FPC version 2.7.1 [2011/09/17] for i386 on Windows. What am I doing wrong? Not reading manuals? :-) http://www.freepascal.org/docs-html/prog/progse5.html#x121-1210002.2 so it is FPC_FULLVERSION, not FPCFULLVERSION from http://delphi.wikia.com/wiki/FreePascal_detection_and_versioning a typical usage: {$if FPC_FULLVERSION 20204} // means greater than 2.2.4 here {$ifndef} Not wanting to hijack the thread but, why isn't there a way to print macro values? (There isn't, is it?) Best regards, Flávio ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to do conditional compilation with macros
In our previous episode, Fl?vio Etrusco said: http://delphi.wikia.com/wiki/FreePascal_detection_and_versioning a typical usage: {$if FPC_FULLVERSION 20204} ? // means greater than 2.2.4 here ?{$ifndef} Not wanting to hijack the thread but, why isn't there a way to print macro values? (There isn't, is it?) No. http://bugs.freepascal.org/view.php?id=12935 I still think this is a good thing, mostly because this is a way to get versions etc embedded in the program into the binary without going through an includefile processor. so fpc -dfreebsdversion:=`uname -r` and then {$i %freebsdversion%} According to Jonas it can also be done via the environment, and for me that was enough back then (which is why the report is closed). But in retrospect that is fine for commandline, but harder for IDE usage. (which often allows to set additional cmdline options, but not specify the environment, specially not on all targets) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to do conditional compilation with macros
On Sun, Sep 18, 2011 at 9:19 AM, Marco van de Voort mar...@stack.nl wrote: In our previous episode, Fl?vio Etrusco said: http://delphi.wikia.com/wiki/FreePascal_detection_and_versioning a typical usage: {$if FPC_FULLVERSION 20204} ? // means greater than 2.2.4 here ?{$ifndef} Not wanting to hijack the thread but, why isn't there a way to print macro values? (There isn't, is it?) No. http://bugs.freepascal.org/view.php?id=12935 I still think this is a good thing, mostly because this is a way to get versions etc embedded in the program into the binary without going through an includefile processor. so fpc -dfreebsdversion:=`uname -r` and then {$i %freebsdversion%} According to Jonas it can also be done via the environment, and for me that was enough back then (which is why the report is closed). But in retrospect that is fine for commandline, but harder for IDE usage. (which often allows to set additional cmdline options, but not specify the environment, specially not on all targets) ___ Thanks for the information and tips. I hadn't thought about using environment variables, maybe I'll add it to Lazarus :) Best regards, Flávio ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Hints on getting FPDocs to work on Linux
Hi gang, total Latex newbie here Any hints on which packages to install on Debian Squeeze (current stable) or which files are required so I can try generating some FPDocs content? Something like aptitude install texlive tex4ht python-plastex hevea dvi2tty perhaps? (Looking into writing some documentation on the db export units, but not so sure about my patches want to test first how they end up looking) Thanks, Reinier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Hints on getting FPDocs to work on Linux
In our previous episode, Reinier Olislagers said: total Latex newbie here Any hints on which packages to install on Debian Squeeze (current stable) or which files are required so I can try generating some FPDocs content? Something like aptitude install texlive tex4ht python-plastex hevea dvi2tty perhaps? texlive and tex4ht. plastex and hevea are tex4ht alternatives, and not commonly used. dvi2tty only if you want to generate plain txt docs. (for dos mainly) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Hints on getting FPDocs to work on Linux
On 18/09/2011, Reinier Olislagers wrote: Any hints on which packages to install on Debian Squeeze (current stable) or which files are required so I can try generating some FPDocs content? Tip #1: Install a distro geared for programmers. ;-) Slackware includes everything a developer needs out of the box. C, C++, Fortan compilers and more. Compiling FPC or Lazarus works out of the box. FPDoc generated PDF etc. all work out of the box because LaTeX comes standard with Slackware. All pretty awesome for any developer. Sorry I couldn't be of more help. I can add, that I am working on a rewrite of the RTF output writer for FPDoc. This will generate RTF docs very similar to the current PDF ones - including hyperlinking. The current RTF output in any released FPC is just useless. My idea is that you generate the RTF output, then open those RTL files with OpenOffice and simply select Export to PDF. Much less dependency for Linux, Windows or MacOSX users - well, most Linux distros include OpenOffice as standard. This idea has another benefit. Currently the FPDoc PDF output is only A4, but I prefer A5 for reading on my iPad. I did manage to generate A5 docs but they have a pretty screwed layout. My initial testing with RTF and OpenOffice, is that the A5 PDF output is MUCH better. -- Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Hints on getting FPDocs to work on Linux
On 18/09/2011, Reinier Olislagers wrote: PS: aptitude install lazarus fpc fpc-source isn't too difficult to get FPC/Lazarus going in Debian either ;) I never install binary releases of the various distro packages - they are always out of date. Installing from source and wanting to compile, you need all the *-devel packages, which comes standard with Slackware. So it just works. Your post did remind me to check whether git is installed though, thanks ;) Did I mention SVN and Git come standard with Slackware too. :-) Personally, I'd rather see some more content in the help files than yet another way of generating the stuff, That's the problem for the documentation writers, not for the documentation tools. On the topic, I can add that the FPC docs are very good. It's class documentation from other frameworks that are lacking. -- Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Hints on getting FPDocs to work on Linux
On 18-9-2011 23:27, Graeme Geldenhuys wrote: On 18/09/2011, Reinier Olislagers wrote: I never install binary releases of the various distro packages - they are always out of date. LazUpdater ftw ;) (When I have it working on Linux) Your post did remind me to check whether git is installed though, thanks ;) Did I mention SVN and Git come standard with Slackware too. :-) Could have guessed though ;) Still, it comes down to what one is most comfortable with. And if you want to, you can use a preseed file (IIRC) that customises your Debian install, similar to RedHat kickstart. Used it once to generate a working, configured VPN server from an ISO. ... leaving out other methods like puppet, FAI etc, but I've never used these in anger yet. Personally, I'd rather see some more content in the help files than yet another way of generating the stuff, That's the problem for the documentation writers, not for the documentation tools. True, if you want to divide people into categories ;) On the topic, I can add that the FPC docs are very good. It's class documentation from other frameworks that are lacking. Yep, such as a certain well-known Delphi clone... See you, Reinier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal