Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2017-05

List pre-defined defines

13 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jon Foster

I've looked several times over the years for a way to get fpc to dump all of the predefined "defines" for the target selected. Things like "fpc", "linux", "unix", "android", "cpuarm", "cpui386", ... and who knows what else. Seems like there ought to be an "-i?" switch for this. Have I just missed it? Is there something to dump all of the built in defines for the current target?

I have a couple of needs for this:

1. A "menu" of sorts to figure out which is the best define to make my code adapt to a given target, like when I wrote something for i386 and then discover I need to do something different for x64 or arm.

2. I have tools to extract code sections from Pascal sources. but I don't always know which ifdefs to follow.

3. Just 'cause I'm curios... I guess that's more than 2. :-)

TIA - Jon

Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc.

Reply by email

Mattias Gaertner
to Jon Foster
Show quoted text 6 lines
I've looked several times over the years for a way to get fpc to dump all of the predefined "defines" for the target selected. Things like "fpc", "linux", "unix", "android", "cpuarm", "cpui386", ... and who knows what else. Seems like there ought to be an "-i?" switch for this. Have I just missed it? Is there something to dump all of the built in defines for the current target?

touch mytest
fpc -vc mytest

Show quoted text 5 lines
I have a couple of needs for this: 1. A "menu" of sorts to figure out which is the best define to make my code adapt to a given target, like when I wrote something for i386 and then discover I need to do something different for x64 or arm.

Lazarus completion box inside an $IFDEF shows the above macros.

2. I have tools to extract code sections from Pascal sources. but I don't always know which ifdefs to follow.

Lazarus source editor shows inactive $IFDEF regions.

3. Just 'cause I'm curios... I guess that's more than 2. :-)

Mattias

Reply by email

Michael Van Canneyt
to Jon Foster: I've looked several times over the years for a way to get fpc to dump all of the…
Jon Foster wrote 6 lines
I've looked several times over the years for a way to get fpc to dump all of the predefined "defines" for the target selected. Things like "fpc", "linux", "unix", "android", "cpuarm", "cpui386", ... and who knows what else. Seems like there ought to be an "-i?" switch for this. Have I just missed it? Is there something to dump all of the built in defines for the current target?

-vc does this. You'll need a source file, though.

Michael.

Reply by email

Jon Foster
to Mattias Gaertner: On Tue, 16 May 2017 14:45:42 -0700 touch mytest fpc -vc mytest Lazarus completion box…
Mattias Gaertner wrote 11 lines
On Tue, 16 May 2017 14:45:42 -0700 Jon Foster wrote: > I've looked several times over the years for a way to get fpc to dump all > of the predefined "defines" for the target selected. Things like "fpc", > "linux", "unix", "android", "cpuarm", "cpui386", ... and who knows what > else. Seems like there ought to be an "-i?" switch for this. Have I just > missed it? Is there something to dump all of the built in defines for the > current target? touch mytest fpc -vc mytest

Thanks fellas! I guess I always figured that was source code specific information. Works good, even without source. Just have to ignore the exit code. :-D

THX!

Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc.

Reply by email

Jon Foster
to Jon Foster
Jon Foster wrote 13 lines
On 05/17/2017 05:40 AM, Ewald wrote: > On 16/05/17 23:53, Mattias Gaertner wrote: >> touch mytest >> fpc -vc mytest > Perhaps a one-liner: > fpc -vc /dev/null > > ? > > Saves one the need to create a dummy file and remove it afterward ;-) I like it!

Although that won't work on windoze! ;-)

Sent from my Debian Linux workstation -- http://www.debian.org/intro/about Jon Foster JF Possibilities, Inc.

Reply by email

Sven Barth
to Jon Foster
"Jon Foster" wrote 22 lines
On 05/18/2017 08:46 AM, Jon Foster wrote: > > > On 05/17/2017 05:40 AM, Ewald wrote: >> >> On 16/05/17 23:53, Mattias Gaertner wrote: >>> >>> touch mytest >>> fpc -vc mytest >> >> Perhaps a one-liner: >> fpc -vc /dev/null >> >> ? >> >> Saves one the need to create a dummy file and remove it afterward ;-) > > I like it! > Although that won't work on windoze! ;-)

fpc -vc NUL

;)

Regards,
Sven

Reply by email

Sven Barth
to Marco van de Voort
"Marco van de Voort" wrote 7 lines
In our previous episode, Sven Barth via fpc-pascal said: > > fpc -vc NUL > But I assume that requires executing a shell?

If I remember correctly it should not (though I could be wrong of course).

Regards,
Sven

Reply by email