Get Dyalog version information in function
4 posts
• Page 1 of 1
Get Dyalog version information in function
Dear all,
Is there a way to get the information from ]version in a function. I would like to know at runtime at which OS I am running on.
Kind regards,
Florian
Is there a way to get the information from ]version in a function. I would like to know at runtime at which OS I am running on.
Kind regards,
Florian
- bilekflo
- Posts: 28
- Joined: Wed Mar 12, 2014 10:07 pm
Re: Get Dyalog version information in function
That is an interesting question !
At the simplest level you can look
However it doesn't differentiate between, for example, Linux on x86 and Linux on Arm. The following snippet of code attempts to do this (it's from NonWindows.Setup in the supplied quadna workspace):
However, that I now realise has its limitations: on macOS it doesn't distinguish between running on Intel-based Macs or ARM-based Macs under Rosetta (or for the future, a native ARM-based Dyalog running on ARM).
However, let's cross that bridge when we come to it. I'd go with the code above, but make sure that it's in a cover function: watch this space for a possible better solution to this !
At the simplest level you can look
3↑⊃'.'⎕wg'APLVersion'which will tell you what O/S you're running on: Win, Lin, AIX, Mac.
However it doesn't differentiate between, for example, Linux on x86 and Linux on Arm. The following snippet of code attempts to do this (it's from NonWindows.Setup in the supplied quadna workspace):
:Select 3↑⊃'.'⎕WG'APLversion'
:Case 'AIX'
opsys←'AIX'
:Case 'Mac'
opsys←'Mac'
:Case 'Win'
opsys←'Windows'
:Case 'Lin'
:Select 4↑⊃⎕SH'uname -a'
:Case 'armv'
opsys←'Pi'
:Else
opsys←'Linux'
:EndSelect
:EndSelect
⍝
apledition←⊃(80=⎕DR' ')↓'Classic' 'Unicode'
aplwidth←{z←⍵ ⋄ 2×⍬⍴⎕SIZE'z'}⍬
However, that I now realise has its limitations: on macOS it doesn't distinguish between running on Intel-based Macs or ARM-based Macs under Rosetta (or for the future, a native ARM-based Dyalog running on ARM).
However, let's cross that bridge when we come to it. I'd go with the code above, but make sure that it's in a cover function: watch this space for a possible better solution to this !
-
AndyS|Dyalog - Posts: 263
- Joined: Tue May 12, 2009 6:06 pm
Re: Get Dyalog version information in function
Of course, you can do this (which may not be recommended):
- Code: Select all
capture← ⎕SE.UCMD'Version' ⍝ Execute an arbitrary user command
capture
- Code: Select all
Dyalog 18.2.45405 64-bit Unicode, BuildID a02bc166
OS Darwin 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:22 PDT 2023; root:xnu-8796.121.3~7/RELEASE_X86_64
Link 3.0.19
SALT 2.9
UCMD 2.51
.NET .NET Core 3.1.5
WS 18.2
- petermsiegel
- Posts: 160
- Joined: Thu Nov 11, 2010 11:04 pm
Re: Get Dyalog version information in function
Hi Andy,
Great. Thank you for this interesting solution.
I needed it to decide how to issue some correct system commands.
Best regards
Florian
Great. Thank you for this interesting solution.
I needed it to decide how to issue some correct system commands.
Best regards
Florian
- bilekflo
- Posts: 28
- Joined: Wed Mar 12, 2014 10:07 pm
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group