====== Reading System Configurations=====
^Published By^Date^Version^Knowledge Level^Keywords^
|Revelation Technologies|19 MAR 1991|2.1X|EXPERT|GETCONFIGURE|
A fair amount of information is available to you about the configuration of
your Advanced Revelation system and the hardware on on which it is running.
For instance, the serial number of your copy of Advanced Revelation is
available through the R/BASIC function SERIAL(), while the current account
name is available via the variable @ACCOUNT. Very briefly, R/BASIC contains
these variables and functions that provide system configuration information:
@ACCOUNT
@CPU.TYPE
@EXIST8087
@STATION
@USERNAME
SERIAL()
Other information is available, but only via functions or subroutines, or in
previously undocumented locations. This technical bulletin reviews the
system configuration information that is or is not available to R/BASIC
programmers.
**Note**: Unless otherwise noted, the information here applies to all versions
of Advanced Revelation. However, starting with version 2.1 the only safe way
to get this information is through GETCONFIGURE. See below for information
about calling GETCONFIGURE.
==== GETCONFIGURE ====
Starting with version 2.1 of Advanced Revelation the subroutine GETCONFIGURE
is the method of choice for getting system configuration information. The
other methods outlined in this Technical Bulletin may or may not continue to
be supported in the future. However, GETCONFIGURE will return the same
information.
For applications running at version 2.1 or higher, you should only use
GETCONFIGURE. This will minimize your maintenance problems should one of the
methods used to derive the information needed by your program change.
==== Runtime Number ====
A version of Advanced Revelation can be one of three "runtime levels":
* Limited demo
* Runtime
* Full development copy
In addition, the latter two types may be single user or may have been bumped
using a LAN Pack to be functional on a network.
**Note**: The limited demo is a version of Advanced Revelation that can be used
for a fixed number of days (currently 45 days). It is otherwise a fully
functional version of Advanced Revelation that can run user applications.
The function RUNTIME( ) in R/BASIC returns an integer value that serves as a
series of bit-flags summarizing the runtime level of the current version of
Advanced Revelation. Using the R/BASIC bitwise BITAND function, you can
determine the runtime level and bumping level of the system currently
running.
Because individual bits within the runtime number are significant, and not
the value as a whole, you must test for conditions such as "bumped runtime"
using two separate tests. Note also that there is no specific setting for a
full development version; you can assume this if the current version is not
a Runtime or limited demo version.
=== Limited Demo ===
If the current version of Advanced Revelation is a limited demo version, the
17th bit (65536) of the value returned by the RUNTIME( ) function is set.
You can therefore determine this condition using a test like this one:
IF BITAND( RUNTIME(), 65536 ) THEN
* this is a demo version
END
=== Runtime ===
In a Runtime version, the 12th bit (2048) is cleared. Use this test to
determine if the current version is a Runtime version:
IF NOT( BITAND( RUNTIME(), 2048 ) ) THEN
* this is a runtime version
END
or:
IF BITAND( RUNTIME(), 2048 ) ELSE
* this is a runtime version
END
=== Bumped ===
If the current version of Advanced Revelation has been bumped, the 16th bit
(32768) is set. Use this test:
IF BITAND( RUNTIME(), 32768 ) THEN
* this is a bumped version
END
==== Networking ====
There is no means for Advanced Revelation to determine directly what type of
network it is running on. In addition, the number of network users available
to the current copy of Advanced Revelation is not available to developers.
However, there are indirect methods to determine if the current copy of
Advanced Revelation has been bumped, and what network driver has been
loaded.
If the current copy of Advanced Revelation has been bumped using a LAN Pack,
the RUNTIME( ) function will return true on a BITAND of the mask number
32768. See the topic "Runtime" above.
=== Network Driver and Version ===
The type and version of the current network driver is not stored in any
accessible location in the system. Nonetheless, it may be indirectly derived
from information stored in the object code for the boot filing system,
almost always Linear Hash (RTP57).
The object code for RTP57 is stored in the file REVBOOT at the DOS level.
Within this REVBOOT file, RTP57 is the second program. Because the word
COPYRIGHT is always embedded in the object code of a program, the second
appearance of this word identifies the object code for RTP57. Following this
word is additional information, and, in quotes, after the word COPYRIGHT is
the network name and the driver version. Figure 1 illustrates an external
function that extracts and returns this network information.
==== System Level, Upgrades, and Optional Modules ====
In Advanced Revelation 2.0 and higher, the system subroutine GETCONFIGURE
returns information about the current version (for example, 2.03), about
what upgrades and updates have been applied to the current version, and
about what optional modules have been installed.
GETCONFIGURE requires one argument in which it returns a dynamic array. The
array layout is described completely in the INCLUDE file record
CONFIGURE.RECORD.EQUS. An example of using GETCONFIGURE might be:
CALL GETCONFIGURE( CONFIGURATION )
TEXT = "Current version = %1%"
MSG(TEXT, '', '', CONFIGURATION<1>)
**Note**: There is no means of deriving this information in versions 1.x of
Advanced Revelation.
==== Memory ====
The function MEMSPACE can be used to report the amount of conventional
memory (string space) currently available. Call the function and pass it an
integer value that exceeds the amount of total memory in the system. The
function returns as an error condition the amount actually available. For
example, in this fragment the variable AVAIL will be loaded with the current
amount of free string space:
DECLARE FUNCTION MEMSPACE
AVAIL = MEMSPACE(9999999)
This function yields the total amount of string space available. There is no
means of having the system report usage of string space, such as is
available by entering "#" at the debugger prompt.
**Note**: Information about the current status of expanded memory for example,
the amount available, the addresses of the windows, etc. is not available to
developers.
==== Video ====
Various system subroutines and functions can tell you whether the current
system is defined as using color or mono, what type of video card is
installed, and what the current video mode is. Figure 2 illustrates a
program that returns all three pieces of information.
=== Monitor Type ===
The subroutine MONITOR takes a single argument, and returns the value 7 if
your system is monochrome, or any other value for a color system.
=== Video Card ===
As of Version 2.02 of Advanced Revelation, the subroutine VCARD takes a
single argument and returns an integer corresponding to these video card
identifiers:
^Value^Meaning^
|0|MDA|
|1|CGA|
|2|EGA|
|3|PGA|
|4|VGA|
|5|MCGA|
|6|Unknown type|
=== Video Mode ===
As of Version 2.02 of Advanced Revelation, the external function
GET_VID_INFO takes a single argument indicating what information you wish to
return. Pass one of these values:
^Value^Request^
|1|Return current video mode|
|2|Return maximum columns|
|3|Return maximum rows|
If you pass 1, GET_VID_INFO returns an integer value that identifies the
current video mode:
^Value^Meaning^
|0|Text (default) mode|
|2|EGA43|
|4|VGA43|
|5|VGA50|
==== Printer ====
The system subroutine PRNSTAT can determine whether there is a printer
available to the current system. This routine was described in detail in
Technical Bulletin #15. However, a brief example program is provided in
Figure 3.
==== Examples ====
=== Figure 1 ===
FUNCTION NETTYPE
NET.TYPE = ""
* read the file REVBOOT from DOS
REVBOOT.REC = XLATE("DOS", "REVBOOT", "", "X")
* find 2nd appearance of the word "COPYRIGHT" in REVBOOT
POS = INDEX(REVBOOT.REC,'COPYRIGHT',2)
* extract the copyright message
COPYRIGHT = REVBOOT.REC[POS,"F":@FM]
* extract information between quotes (network name and driver version)
NET.TYPE = FIELD(COPYRIGHT,'"',2)
IF NET.TYPE ELSE NET.TYPE = "Unknown"
RETURN NET.TYPE
=== Figure 2 ===
DECLARE SUBROUTINE MONITOR, VCARD, MSG
DECLARE FUNCTION GET_VID_INFO
* monitor type
MONITOR( MTYPE )
IF MTYPE EQ 7 THEN MTYPE = "Monochrome" ELSE MTYPE = "Color"
* video card
ALL_VCARD_TYPES = "MDA,CGA,EGA,PGA,VGA,MCGA"
VCARD( VCARD_TYPE )
VCARD_TYPE = FIELD( ALL_VCARD_TYPES, ',', VCARD_TYPE+1 )
* current video mode
ALL_VIDEO_MODES = ''
ALL_VIDEO_MODES<1> = "Text,EGA25,EGA43,VGA25,VGA43,VGA50,VGA16"
VIDEO_MODE = GET_VID_INFO( 1 )
VIDEO_MODE = FIELD( ALL_VIDEO_MODES, ',', VIDEO_MODE + 1 )
TEXT = ""
TEXT<-1> = " Monitor type = %1%"
TEXT<-1> = " Video card = %2%"
TEXT<-1> = " Video mode = %3%"
MAP = 'A'
MAP<6> = 'L'
PARMS = ''
PARMS<1,1> = MTYPE
PARMS<1,2> = VCARD_TYPE
PARMS<1,3> = VIDEO_MODE
MSG(TEXT,MAP,'',PARMS)
STOP
=== Figure 3 ===
CALL PRNSTAT( ERROR )
IF ERROR THEN
CALL MSG("Error %1% in printer",'','',ERROR)
END