PlatformInfoLib — Platform Information
Detect and query operating system information. Useful for cross-platform applets that adapt behavior based on the host system. 8 unique functions + 2 overloads = 10 registered signatures.
| Category | Count | Description |
|---|---|---|
| Platform ID | 3 | os_platform$, os_name$, os_architecture$ |
| Version Info | 3 | os_major, os_minor, os_build |
| Version Check | 2 | os_check (2-param and 3-param overloads) |
| Service Pack | 2 | os_spmajor, os_spminor |
| Supported Platform | Identification | Architecture |
|---|---|---|
| Windows 10/11 | Windows 10 / Windows 11 | IntelX86, IntelX64 |
| macOS | macOS Sonoma, etc. | IntelX64, ARM64 (Apple Silicon) |
| Linux | Linux | IntelX64, ARM64 |
| Android | Android | ARM32, ARM64 |
| iOS | iOS | ARM64 |
Platform Identification
| Function | Signature | Description |
|---|---|---|
os_platform$() | os_platform$@ | Full platform description (name + version + architecture) |
os_name$() | os_name$@ | OS name only (e.g. "Windows 11", "macOS Sonoma", "Android") |
os_architecture$() | os_architecture$@ | CPU architecture string |
| Platform | os_platform$() Example |
|---|---|
| Windows 11 | Windows 11 (Version 23H2, Build 22631, 64-bit) |
| Windows 10 | Windows 10 (Version 21H2, Build 19044, 64-bit) |
| macOS | macOS 14.0 (Build 23A344) |
| Linux | Linux (Ubuntu 22.04) |
| Android | Android 13.0 |
| iOS | iOS 17.0 |
| Architecture Value | Description |
|---|---|
IntelX86 | 32-bit Intel/AMD |
IntelX64 | 64-bit Intel/AMD |
ARM32 | 32-bit ARM |
ARM64 | 64-bit ARM (Apple Silicon, modern mobile, etc.) |
println "Platform: "; os_platform$() println "OS Name: "; os_name$() println "Arch: "; os_architecture$() ' Platform-specific branching name$ = os_name$() if instr(name$, "Windows") >= 0 then println "Windows-specific code" else if instr(name$, "macOS") >= 0 then println "macOS-specific code" else if instr(name$, "Android") >= 0 then println "Android-specific code" endif
Version Information
| Function | Signature | Description |
|---|---|---|
os_major() | os_major@ | Major version number |
os_minor() | os_minor@ | Minor version number |
os_build() | os_build@ | Build number |
| Platform | Major | Minor | Build Notes |
|---|---|---|---|
| Windows 11 | 10 | 0 | Build ≥ 22000 indicates Win 11 |
| Windows 10 | 10 | 0 | Build < 22000 |
| macOS Sonoma | 14 | x | Directly maps to macOS version |
| macOS Ventura | 13 | x | |
| Android 13 | 13 | 0 | Corresponds to Android version |
| iOS 17 | 17 | x | Corresponds to iOS version |
println "Version: "; os_major(); "."; os_minor() println "Build: "; os_build() ' Windows 11 detection (both Win 10 & 11 report major=10) if os_major() = 10 then if os_build() >= 22000 then println "Windows 11" else println "Windows 10" endif endif
⚠ Warning: On Windows, both Windows 10 and 11 report
os_major() = 10. Use os_build() ≥ 22000 to detect Windows 11.Version Checking
| Function | Signature | Description |
|---|---|---|
os_check(major, minor) | os_check@nn | OS version ≥ specified? (1/0) |
os_check(major, minor, sp) | os_check@nnn | Version + service pack check (1/0) |
' Require Windows 10+ if os_check(10, 0) = 1 then println "Windows 10 or later" endif ' Require macOS 11 (Big Sur)+ if os_check(11, 0) = 1 then println "macOS 11 or later" endif ' Require Android 10+ if os_check(10, 0) = 1 then println "Android 10 or later" endif ' Legacy: Windows 7 SP1 check if os_check(6, 1, 1) = 1 then println "Windows 7 SP1 or later" endif
ⓘ Note: The 3-parameter overload with service pack is primarily useful for legacy Windows (7, 8). Modern systems (Win 10+, macOS, Linux, mobile) return 0 for service pack.
Service Pack Information
| Function | Signature | Description |
|---|---|---|
os_spmajor() | os_spmajor@ | Service pack major version (0 if not applicable) |
os_spminor() | os_spminor@ | Service pack minor version (usually 0) |
sp = os_spmajor() if sp > 0 then println "Service Pack "; sp; "."; os_spminor() else println "No service pack (or not applicable)" endif
ⓘ Note: Service packs are a Windows-specific concept. On modern Windows (10+), macOS, Linux, Android, and iOS these functions return 0.
Complete Examples
System Information Display
println "=== System Information ===" println "" println "Platform: "; os_platform$() println "OS Name: "; os_name$() println "Architecture: "; os_architecture$() println "" println "Version: "; os_major(); "."; os_minor() println "Build: "; os_build() println "" if os_spmajor() > 0 then println "Service Pack: "; os_spmajor(); "."; os_spminor() else println "Service Pack: N/A" endif
Platform-Specific Code
println "=== Platform Detection ===" name$ = os_name$() if instr(name$, "Windows") >= 0 then println "Running on Windows" if os_build() >= 22000 then println " Windows 11" else if os_major() >= 10 then println " Windows 10" else println " Older Windows" endif else if instr(name$, "macOS") >= 0 then println "Running on macOS "; os_major(); "."; os_minor() else if instr(name$, "Linux") >= 0 then println "Running on Linux" else if instr(name$, "Android") >= 0 then println "Running on Android "; os_major() else if instr(name$, "iOS") >= 0 then println "Running on iOS "; os_major(); "."; os_minor() else println "Unknown: "; name$ endif
Minimum Version Requirements
println "=== Requirements Check ===" allOk = 1 name$ = os_name$() ' Architecture arch$ = os_architecture$() println "Architecture: "; arch$ if arch$ = "IntelX86" then println " WARNING: 32-bit - features may be limited" else println " OK: 64-bit system" endif ' Platform version checks if instr(name$, "Windows") >= 0 then if os_check(10, 0) = 1 then println "Windows: OK (10+)" else println "Windows: FAIL (requires 10+)" allOk = 0 endif else if instr(name$, "macOS") >= 0 then if os_check(11, 0) = 1 then println "macOS: OK (11+)" else println "macOS: FAIL (requires 11+)" allOk = 0 endif else if instr(name$, "Android") >= 0 then if os_check(10, 0) = 1 then println "Android: OK (10+)" else println "Android: FAIL (requires 10+)" allOk = 0 endif else if instr(name$, "iOS") >= 0 then if os_check(14, 0) = 1 then println "iOS: OK (14+)" else println "iOS: FAIL (requires 14+)" allOk = 0 endif endif println "" if allOk = 1 then println "All requirements met!" else println "Some requirements not met." endif
System Report Generator
println "=== System Report ===" report$ = "SYSTEM REPORT" + chr$(10) report$ = report$ + "=============" + chr$(10) + chr$(10) report$ = report$ + "Platform: " + os_platform$() + chr$(10) report$ = report$ + "OS Name: " + os_name$() + chr$(10) report$ = report$ + "Architecture: " + os_architecture$() + chr$(10) report$ = report$ + "Version: " + stri$(os_major(), 0) + "." + stri$(os_minor(), 0) + chr$(10) report$ = report$ + "Build: " + stri$(os_build(), 0) + chr$(10) if os_spmajor() > 0 then report$ = report$ + "SP: " + stri$(os_spmajor(), 0) + "." + stri$(os_spminor(), 0) + chr$(10) endif println report$
Platform-Specific Notes
| Platform | Notes |
|---|---|
| Windows | os_major() returns 10 for both Win 10 and 11. Use os_build() ≥ 22000 for Win 11. Service packs meaningful only for Win 7/8. |
| macOS | os_major() maps directly to version (14=Sonoma, 13=Ventura). os_architecture$() returns ARM64 on Apple Silicon, IntelX64 on Intel Macs. SP returns 0. |
| Linux | Version info depends on distribution and kernel. Architecture is accurate. SP returns 0. |
| Android | os_major() corresponds to Android version. Architecture typically ARM64 or ARM32. SP returns 0. |
| iOS | os_major() maps directly to iOS version. Architecture is ARM64 on modern devices. SP returns 0. |
Quick Reference
| Function | Signature | Description |
|---|---|---|
os_platform$() | os_platform$@ | Full platform description |
os_name$() | os_name$@ | OS name only |
os_architecture$() | os_architecture$@ | CPU architecture (IntelX86/X64, ARM32/64) |
os_major() | os_major@ | Major version number |
os_minor() | os_minor@ | Minor version number |
os_build() | os_build@ | Build number |
os_check(major, minor) | os_check@nn | Version ≥ specified? (1/0) |
os_check(major, minor, sp) | os_check@nnn | Version + SP check (1/0) |
os_spmajor() | os_spmajor@ | Service pack major (0 if N/A) |
os_spminor() | os_spminor@ | Service pack minor (0 if N/A) |
8 unique functions, 10 registered signatures across 4 categories.