Writing System-specific Code
For situations in which system-specific code is necessary, for instance when specifying a filename, PV-WAVE provides two methods for determining which system is running the procedure. The first is the GETPLATFORM standard library routine, and the second is the !VERSION system variable.
The GETPLATFORM routine is the preferred method as it returns a unique, consistent string identifying the current platform. The !VERSION system variable is a structure which contains a mix of hardware and software identifiers that have been added over time as support for new platforms was added and, as such, can be somewhat inconsistent.
The following code segment illustrates the use of GETPLATFORM to allow different commands to be executed for Windows and UNIX:
IF STRMATCH(GETPLATFORM(), 'win') THEN BEGIN
; Windows code
ENDIF ELSE BEGIN
; UNIX code
ENDELSE
The following table lists the supported PV-WAVE platforms and the string returned by GETPLATFORM for each:
The !VERSION system variable structure provides three structure elements which may be used to identify the current platform: OS, ARCH, and PLATFORM. The values of !VERSION.OS are listed in the following table:
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.