List pre-defined defines

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

List pre-defined defines

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.
[hidden email]

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: List pre-defined defines

Mattias Gaertner
On Tue, 16 May 2017 14:45:42 -0700
Jon Foster <[hidden email]> 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

 
> 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: List pre-defined defines

Michael Van Canneyt
In reply to this post by Jon Foster


On Tue, 16 May 2017, 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?

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

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: List pre-defined defines

Jon Foster
In reply to this post by Mattias Gaertner

On 05/16/2017 02:53 PM, Mattias Gaertner wrote:

> On Tue, 16 May 2017 14:45:42 -0700
> Jon Foster <[hidden email]> 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.
[hidden email]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: List pre-defined defines

Graeme Geldenhuys-6
In reply to this post by Mattias Gaertner
On 2017-05-16 22:53, Mattias Gaertner wrote:
> touch mytest
> fpc -vc mytest

:-D  That's just genius!

Regards,
   Graeme

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: List pre-defined defines

Graeme Geldenhuys-6
In reply to this post by Jon Foster
On 2017-05-16 23:25, Jon Foster wrote:
> Works good, even without source.

With a source file it gives a few more options.

eg: These are missing without a source file. There might be others too.

Macro FPC_VERSION set to 2
Macro FPC_RELEASE set to 6
Macro FPC_PATCH set to 4
Macro FPC_FULLVERSION set to 20604


Regards,
   Graeme

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: List pre-defined defines

Ewald-2
In reply to this post by Mattias Gaertner
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 ;-)


--
Ewald
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: List pre-defined defines

Jon Foster
In reply to this post by Graeme Geldenhuys-6

On 05/17/2017 04:52 AM, Graeme Geldenhuys wrote:
> On 2017-05-16 23:25, Jon Foster wrote:
>> Works good, even without source.
>
> With a source file it gives a few more options.
>
Thanks Graeme!

--
Sent from my Debian Linux workstation -- http://www.debian.org/intro/about

Jon Foster
JF Possibilities, Inc.
[hidden email]

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: List pre-defined defines

Jon Foster
In reply to this post by Ewald-2

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!

--
Sent from my Debian Linux workstation -- http://www.debian.org/intro/about

Jon Foster
JF Possibilities, Inc.
[hidden email]

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: List pre-defined defines

Jon Foster
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! ;-)

--
Sent from my Debian Linux workstation -- http://www.debian.org/intro/about

Jon Foster
JF Possibilities, Inc.
[hidden email]

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: List pre-defined defines

Free Pascal - General mailing list

Am 18.05.2017 17:47 schrieb "Jon Foster" <[hidden email]>:
>
> 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


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: List pre-defined defines

Marco van de Voort
In our previous episode, Sven Barth via fpc-pascal said:
>
> fpc -vc NUL
>

But I assume that requires executing a shell?
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: List pre-defined defines

Free Pascal - General mailing list

Am 18.05.2017 22:01 schrieb "Marco van de Voort" <[hidden email]>:
>
> 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


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal