OScript API/Built-in Package Index

Class: System

The System built-in functions are a collection of methods and attributes designed to aid the programmer in obtaining information about Content Server itself, and the environment in which Content Server is running. This information ranges from the version number of the operating system, to thread identifiers, to the file extensions used for shared libraries. Almost none of these methods have the ability to change the environment in any way - they exist simply to return setup, configuration, and environment data.

Class Attributes

The String "DOS".

The Integer constant for the English language.

The Integer constant for the Japanese language.

The Integer constant for the Korean language.

The String "Mac".

The String "Motif".

The Integer constant for the character encoding of Not Encoded.

The String "Unix".

The Integer constant for the character encoding of UTF-8.

The String "Windows".

Class Methods

Gets the Content Server application build number as a String.

AppPatchLevel( ) Deprecated

Gets the Content Server application patch level as a String.

Gets the Content Server version as a String.

Gets the Content Server version as a List.

Resets the baseline values for object reference counts output by System.RefCounts()

CharEncoding( [Integer encodingType] )

Returns or sets the system character encoding.

Returns the thread current Locale suffix.

Returns the system default Locale suffix.

EOL( )

Returns the OS specific line terminator string.

Returns the fallback locale suffix.

FilePrefsPath( [String path] )

Returns or sets the default path of the configuration file.

Returns the Content Server version.

Returns an Assoc containing the date/time formats for all locales.

Returns information on the memory of the system..

Returns the host name of the machine

IntlLanguage( [Integer languageConstant] )

Returns or sets the system default language.

IntlStrings( [Boolean flag] )

Returns or sets if the system will use advanced string handling routines compatible with most languages.

Return TRUE if 64 bit system else FALSE.

Return TRUE if 64 bit Content Server, else FALSE.

Return TRUE if the current locale is displayed right to left, else FALSE.

Determines the language used for the system.

Returns the file extension (including dot) of a shared library in the environment on which Content Server is running.

Mac( )

Indicates whether Content Server is running in a Macintosh environment.

Motif( )

Not used.

MultiByte( [Boolean flag] )

Returns or sets if the system processes strings using multibyte character compatible routines.

Name( )

Determines the name of the operating system on which Content Server is running.

Not used.

Not used.

Outputs the number of refcounted OScript objects of most types and the difference in number of refounted objects since the last time System.BaselineRefCounts() was called.

SetCurrentLocaleSuffix( [String suffix] )

Sets the thread current Locale suffix.

Sleep( [Integer duration] )

Puts the current thread to sleep for a specified number of milliseconds

Returns a unique Integer indicating the current thread identification.

Returns a unique Integer indicating the current thread index.

ThreadStackCrawl( [Boolean verbose] )

Gets a string representation of the backtrace/stackcrawl for the current thread.

Unix( )

True if Content Server is running on a Unix operating system.

Determines the version number of the operating system.

Win32( )

True if Content Server is running in a 32-bit Windows environment.

True if Content Server is running in a Windows environment.

Class Attributes

String DOS

The String "DOS".

Integer English

The Integer constant that represents the English language.

Integer Japanese

The Integer constant that represents the Japanese language.

Integer Korean

The Integer constant that represents the Korean language.

String Mac

The String "Mac".

String Motif

The String "Motif"

Integer NotEncoded

The Integer constant for a character encoding of Not Encoded.

String Unix

The String "Unix"

Integer UTF8

The Integer constant for a character encoding of UTF-8.

String Windows

The String "Windows"

Class Methods

AppBuildNo

String AppBuildNo()

Gets the Content Server application build number as a String.

Returns:

A String representing the build number.

AppPatchLevel

Deprecated
String AppPatchLevel()

Gets the Content Server application patch level as a String.

Returns:

A String representing the patch level.

AppVersion

String AppVersion()

Gets the Content Server version as a String. The major, minor, and incremental release number will appear separated by dots. For example: "8.0.1" would indicate Content Server Version 8.0.1.

Returns:

A String representing the major, minor, and incremental release numbers of Content Server.

AppVersionList

List AppVersionList()

Gets the Content Server version as a List. The major, minor, and incremental release numbers will each appear as elements in the list. For example: {'8','0','1'} would indicate Content Server Version 8.0.1. Development builds will contain a character element 'd' followed by the development build number.

Returns:

A List containing the major, minor, and incremental release number of Content Server.

BaselineRefCounts

Boolean BaselineRefCounts()

Resets the baseline for OScript object refcounts output by System.RefCounts().

Returns:

True

CharEncoding

Integer CharEncoding( [Integer encodingType] )

Gets or sets system character encoding.

Parameters

encodingType

If specified, valid constants are either System.NotEncoded or System.UTF8. This argument should only be used at startup and only in a single threaded (Builder) environment. The multi-threaded server will have this set at startup based on configuration ini settings.

Returns:

The current value. If new value is passed as parameter then the old value is returned.

CurrentLocaleSuffix

String CurrentLocaleSuffix()

Gets the thread current Locale suffix.

Returns:

The current Locale suffix value.

DefaultLocaleSuffix

String DefaultLocaleSuffix()

Gets the system default Locale suffix.

Returns:

The system default Locale suffix value.

EOL

String EOL()

Gets the OS specific line terminator string.

Returns:

The OS specific line terminator string.

FallbackLocaleSuffix

String FallbackLocaleSuffix()

Returns the fall back locale suffix.

Returns:

The fall back locale suffix.

FilePrefsPath

String FilePrefsPath( [String path] )

Gets or sets the fully qualified path of the default configuration file.

Parameters

path

If specified, this string sets the default path to the configuration file. This argument should only be used at startup and only in a single threaded (Builder) environment, since a cached and shared version of the configuration file is used in multi-threaded environments.

Returns:

The fully qualified String path of the default configuration file.

GetContentServerVersionInfo

String GetContentServerVersionInfo()

Returns the Content Server version in the format: "MajorReleaseNumber.EnhancementPackNumber.UpdateNumber".

Returns:

A String containing the Content Server version in the format: "MajorReleaseNumber.EnhancementPackNumber.UpdateNumber".

Example

        When called on the initial release of Content Server 16, it returns "16.0.0".
        When called on the first update Content Server 16 and it returns "16.0.1".

GetLocaleDateFormats

Assoc GetLocaleDateFormats()

Returns an Assoc containing the date/time formats for all locales.

Returns:

An Assoc containing the date/time formats for all locales.

GetMemoryInfo

String GetMemoryInfo()

Returns information on the memory of the system. Values returned depends on the OS and hardware.

Returns:

A string containing information on the memory of the system.

HostName

String HostName()

Retrieves the standard host name of the local machine.

Returns:

A string representing the host name of the local machine.

IntlLanguage

Integer IntlLanguage( [Integer languageConstant] )

Gets or sets system language.

Parameters

languageConstant

If specified, valid constants are System.English, System.Japanese, or System.Korean. This is deprecated and has been replaced with the Locale support. This argument should only be used at startup and only in a single threaded (Builder) environment. The multi-threaded server will have this set at startup based on configuration ini settings.

Returns:

The current value. If new value is passed as parameter then the old value is returned.

IntlStrings

Boolean IntlStrings( [Boolean flag] )

Gets or sets the system international strings flag.

Parameters

flag

If specified, TRUE directs the system to use string handling routines that support international languages, FALSE indicates the system can use 7-bit ASCII only routines. This argument should only be used at startup and only in a single threaded (Builder) environment. The multi-threaded server will have this set at startup based on configuration ini settings.

Returns:

The current value. If new value is passed as parameter then the old value is returned.

Is64Bit

Boolean Is64Bit()

Return TRUE if 64 bit system else FALSE.

Returns:

TRUE if 64 bit system else FALSE.

Is64BitApp

Boolean Is64BitApp()

Return TRUE if 64 bit Content Server, else FALSE.

Returns:

TRUE if 64 bit Content Server, else FALSE.

IsCurrentLocaleRTL

Boolean IsCurrentLocaleRTL()

Return TRUE if the current locale is displayed right to left, else FALSE.

Returns:

TRUE if the current locale is displayed right to left, else FALSE.

LanguageCode

String LanguageCode()

Returns a three character country code indicating the language in which the string resources were compiled, and the language in which the Content Server .XDBs were compiled. For example: "USA" for American English or "GER" for German.

Returns:

A three character string indicating the language used by the Content Server installation.

LibSuffix

String LibSuffix()

Returns the dotted file extension for a shared library in the environment on which Content Server is running, such as ".DLL".

Returns:

A String containing the dotted file extension.

Mac

Boolean Mac()

True if Content Server is running in a Macintosh environment.

Returns:

True if Content Server is running in a Macintosh environment; False otherwise.

Motif

Boolean Motif()

Not used.

Returns:

False.

MultiByte

Boolean MultiByte( [Boolean flag] )

Gets or sets the system multibyte strings flag.

Parameters

flag

If specified, TRUE directs the system to use multibyte string handling routines that support multibyte character sets, FALSE indicates the system will use fixed width character string routines. This argument should only be used at startup and only in a single threaded (Builder) environment. The multi-threaded server will have this set at startup based on configuration ini settings.

Returns:

The current value. If new value is passed as parameter then the old value is returned.

Name

String Name()

Determines the name of the operating system on which Content Server is running.

Returns:

The String name of the operating system on which Content Server is running.

ProfileOff

Boolean ProfileOff()

Not used.

Returns:

Meaningless.

ProfileOn

Boolean ProfileOn()

Not used.

Returns:

Meaningless.

RefCounts

String RefCounts()

Returns a formatted string containing information about the current number of referenced OScript objects.

Returns:

A formatted string containing information about the current number of referenced OScript objects.

Example

The string returned by this method contains 1 line for each refcounted object type. Each line contains 6 fields, separated by 1 or more spaces.

Field 1 is a 4-character Integer, the object type number, i.e. -1 for Strings

Field 2 is a 13-character String, the object type name, i.e. String

Field 3 is a 7-character Integer, the total number of objects of this type allocated on the server

Field 4 is a 7-character Integer, the total number of references to objects of this type allocated on the server

Field 5 is a 7-character Integer, the difference between the current total number of objects of this type allocated on the server and either the total number of objects of this type allocated on the server since the last time System.BaselineRefCounts() was called, or 0 if System.BaselineRefCounts() has never been called.

Field 6 is a 7-character Integer, the difference between the current total number of references to objects of this type allocated on the server and either the total number of references to objects of this type allocated on the server since the last time System.BaselineRefCounts() was called, or 0 if System.BaselineRefCounts() has never been called.

For example, executing this script:

System.BaselineRefCounts()
File        test1 = File.StringToFile( "test1.txt" )
File        test2 = File.StringToFile( "test2.txt" )
List        test3 = { test1, test2 }


echo( System.RefCounts() )

Would produce output similar to:

    -108 ListExpand          0       0       0       0
    -107 File                2       4       2       4
    -102 Socket              1       1       0       0
     -86 Vis                59      99       0       0
     -85 VisTag              0       0       0       0
     -66 CAPILog             1       1       0       0
     -63 PrefSection         0       0       0       0
     -62 DOMParser           0       0       0       0
     -43 SAXParser           4       4       0       0
     -18 Assoc             766     770       0       0
      -9 Fileprefs           3       3       0       0
      -8 Long                0       0       0       0
      -7 Date               61      61       0       0
      -4 Real                0       0       0       0
      -3 Script          14149   14182       0       0
      -2 List            10415   10599       1       1
      -1 String          30709   40246       2       2

Examining the output indicates, for instance, that for objects of type -1, String, there were 30709 String objects allocated on the server at that time and that there were 40246 in-memory references to those 30709 Strings. Furthermore, 2 new String objects had been allocated since the last time System.BaselineRefCounts() was called, and each of those new Strings had only 1 reference to them.

Examining the output for objects of type -107, File, shows that there were 2 File objects allocated on the server at that time and that there were 4 in-memory references to those 2 Files. Furthermore, both of those File objects had been allocated since the last time System.BaselineRefCounts() was called.

SetCurrentLocaleSuffix

String SetCurrentLocaleSuffix( [String suffix] )

Sets the thread current Locale suffix.

Parameters

suffix

The string should be of the form underscore and 2 char language code, optional underscore and 2 char uppercase country code, optional underscore and variant string. For example: _en_US. This argument can be used on a per request basis in order to set the current Locale for that request. The Locale suffix will be used to load the proper localized string property resources.

Returns:

The old Locale suffix value is returned.

Sleep

Boolean Sleep( [Integer duration] )

Puts the current thread to sleep for a period of time.

Parameters

duration

The time duration to sleep in milliseconds.

Returns:

True if Sleep times out normally, False if Sleep returns because of a server shutdown notification.

ThreadID

Integer ThreadID()

Returns the unique Integer indicating the current thread identification.

Returns:

A unique identifying integer assigned to the current thread by the operating system.

ThreadIndex

Integer ThreadIndex()

Returns the unique Integer indicating the current thread's index. For more coherent logging and reference, the Content Server assigns an ordered integer from 1 to n to all threads. In the "single-threaded" Builder environment, the current thread index will always be 0.

Returns:

An integer indicating the current thread index.

ThreadStackCrawl

String ThreadStackCrawl( [Boolean verbose] )

Gets a string representation of the backtrace/stackcrawl for the current thread.

Parameters

verbose

True for a verbose stackcrawl, false for a terse one (default is true).

Returns:

A String representation of the thread's backtrace/stackcrawl.

Unix

Boolean Unix()

True if Content Server is running in a Unix environment.

Returns:

True if Content Server is running in a Unix environment; False otherwise.

Version

String Version()

Determines the version number of the operating system.

Returns:

A String containing the version number of the operating system.

Win32

Boolean Win32()

True if Content Server is running in a 32-bit Windows environment.

Returns:

True if Content Server is running in a 32-bit Windows environment; False otherwise.

Windows

Boolean Windows()

True if Content Server is running in a Windows environment.

Returns:

True if Content Server is running in a Windows environment; False otherwise.

 Copyright © 2023 OpenText Corporation. All rights reserved.