Sign in Join

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

Mailing lists / fpc-pascal / 2011-05

How to get string with target OS and CPU?

6 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Krzysztof

Hi,

I need friendly name of OS and processor need this for "user-agent" header in http client. Some kind of "Linux x86_64 Ubuntu/11.04" ("Linux x86_64" should be enough). "GetEnvironmentVariable" function does not return anything interesting. I can build this string using compiler defines but there is a lot of targets CPU and OS and maybe free pascal have some functions? How free pascal build string name of output executable when I set $(TargetCPU) in lazarus project options?

Regards.

Jonas Maebe
to Krzysztof
Krzysztof wrote 11 lines
I need friendly name of OS and processor need this for "user-agent" header in http client. Some kind of "Linux x86_64 Ubuntu/11.04" ("Linux x86_64" should be enough). "GetEnvironmentVariable" function does not return anything interesting. I can build this string using compiler defines but there is a lot of targets CPU and OS and maybe free pascal have some functions?

http://www.freepascal.org/docs-html/prog/progsu38.html

Jonas

Mattias Gaertner
to Krzysztof: I need friendly name of OS and processor need this for "user-agent" header in http…
Show quoted text 9 lines
Hi, I need friendly name of OS and processor need this for "user-agent" header in http client. Some kind of "Linux x86_64 Ubuntu/11.04" ("Linux x86_64" should be enough). "GetEnvironmentVariable" function does not return anything interesting. I can build this string using compiler defines but there is a lot of targets CPU and OS and maybe free pascal have some functions? How free pascal build string name of output executable when I set $(TargetCPU) in lazarus project options?

Lazarus $(TargetCPU) is lowerCase({$I %FPCTARGETCPU%})

TargetOS is lowerCase({$I %FPCTARGETOS%})

Mattias

Krzysztof
to Mattias Gaertner

Thanks! Exactly what I needed. Is exists similar trick for get widgetset type (QT, GTK)?

2011/5/27 Mattias Gaertner

Show quoted text 27 lines
On Fri, 27 May 2011 13:18:11 +0200 Krzysztof wrote: > Hi, > > I need friendly name of OS and processor need this for > "user-agent" header in http client. Some kind of "Linux x86_64 Ubuntu/11.04" > ("Linux x86_64" should be enough). "GetEnvironmentVariable" function does > not return anything interesting. I can build this string using compiler > defines but there is a lot of targets CPU and OS and maybe free pascal have > some functions? How free pascal build string name of output executable when > I set $(TargetCPU) in lazarus project options? Lazarus $(TargetCPU) is lowerCase({$I %FPCTARGETCPU%}) TargetOS is lowerCase({$I %FPCTARGETOS%}) Mattias _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Mattias Gaertner
to Krzysztof
Thanks! Exactly what I needed. Is exists similar trick for get widgetset type (QT, GTK)?
uses LCLProc;

LCLPlatformDirNames[WidgetSet.LCLPlatform]

Mattias

Krzysztof
to Mattias Gaertner

Thanks :)

P.S. LCLPlatformDirNames is in InterfaceBase unit, not in LCLProc

2011/5/27 Mattias Gaertner

Show quoted text 16 lines
On Fri, 27 May 2011 14:38:52 +0200 Krzysztof wrote: > Thanks! Exactly what I needed. Is exists similar trick for get widgetset > type (QT, GTK)? uses LCLProc; LCLPlatformDirNames[WidgetSet.LCLPlatform] Mattias _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal