The Core class contains a set of functions and constants that are integral to the effective use of OScript. For all intents and purposes, these entities are intrinsics in the language, which is why no class prefix is required when using them.

Most of the Core methods and attributes deal with the dynamic datatypes available within OScript, including comparison and testing of these datatypes, as well as a variety of constants indicating the datatype numbers of the builtin types.

A bit of background on OScript's dynamic datatyping might be in order here. Every value within OScript has a specific datatype associated with it. This datatype determines the behavior of the value within the OScript environment; for example, Strings behave decidedly different than Integers. Associated with each datatype is a datatype name and an integer. Given a value, the type number can be obtained with the Type() function. Given a type number, the name can be obtained with the DatatypeName() function. The Core class contains constants corresponding to the type numbers for various basic types (such as IntegerType, StringType, ListType).

In addition, there are a few miscellaneous functions that are in the intrinsic Core package for unfortunate historical reasons:


Class Attributes Index

 o BooleanType
A constant indicating the datatype number of the datatype Boolean.
 o BytesType
A constant indicating the datatype number of the datatype Bytes.
 o DateType
A constant indicating the datatype number of the datatype Date.
 o DynamicType
A constant indicating the datatype number of the datatype Dynamic.
 o ErrorType
A constant indicating the datatype number of the datatype Error.
 o ExternType
A constant indicating the datatype number of the datatype Extern.
 o False
A constant indicating the Boolean value FALSE.
 o IntegerType
A constant indicating the datatype number of the datatype Integer.
 o ListType
A constant indicating the datatype number of the datatype List.
 o ObjectType
A constant indicating the datatype number of the datatype Object.
 o ObjRefType
A constant indicating the datatype number of the datatype ObjRef.
 o PointType
A constant indicating the datatype number of the datatype Point.
 o RealType
A constant indicating the datatype number of the datatype Real.
 o ScriptType
A constant indicating the datatype number of the datatype Script.
 o StringType
A constant indicating the datatype number of the datatype String.
 o True
A constant indicating the Boolean value TRUE.
 o Undefined
A constant indicating the Undefined value Undefined.
 o UndefinedType
A constant indicating the datatype number of the datatype Undefined.
 o VoidType
A constant indicating the datatype void.

Class Methods Index

 o DatatypeName( Integer arg1 )
For a type number, returns a String containing the corresponding type name.
 o Echo( [Dynamic arg1], [Dynamic arg2], [Dynamic arg3], [Dynamic arg4] )
Converts arguments to a string display format and emits the result to the debug/log output with a log level of INFO. (Alias of EchoInfo)
 o EchoDebug( [Dynamic arg1], [Dynamic arg2], [Dynamic arg3], [Dynamic arg4] )
Converts arguments to a string display format and emits the result to the debug/log output with a log level of DEBUG.
 o EchoError( [Dynamic arg1], [Dynamic arg2], [Dynamic arg3], [Dynamic arg4] )
Converts arguments to a string display format and emits the result to the output/log with a log level of ERROR.
 o EchoInfo( [Dynamic arg1], [Dynamic arg2], [Dynamic arg3], [Dynamic arg4] )
Converts arguments to a string display format and emits the result to the debug/log output with a log level of INFO.
 o EchoStamp( Boolean enable )
Enables/disables a timestamp prefix on Echo output.
 o EchoWarn( [Dynamic arg1], [Dynamic arg2], [Dynamic arg3], [Dynamic arg4] )
Converts arguments to a string display format and emits the result to the output/log with a log level of WARN.
 o GetFeatures( Dynamic arg1, [Boolean dummy] )
Internal use only.
 o IsDefined( Dynamic arg1 )
Determines whether a value is not Undefined.
 o IsError( Dynamic arg1, [Error arg2] )
Determines whether a value is of datatype Error.
 o IsFeature( Dynamic arg1, Dynamic arg2 )
Indicates whether a value has the given feature.
 o IsInvokable( Dynamic arg1 )
Indicates whether the specified value can be invoked.
 o IsNotError( Dynamic arg1, [Error arg2] )
Determines whether a value is of datatype Error and, if so, optionally tests equality against another Error value.
 o IsNotSet( Dynamic arg1 )
Deprecated. Determines whether a value is the special pseudo-value NotSet.
 o IsObject( Dynamic arg1 )
Determines whether a value is of datatype Object.
 o IsSet( Dynamic arg1 )
Deprecated. Determines whether a value is not the special pseudo-value NotSet.
 o IsUndefined( Dynamic arg1 )
Determines whether a value is the special value Undefined.
 o Length( Dynamic arg1 )
Returns the length of the specified value.
 o NParameters()
Indicates the number of actual parameters passed to the current function.
 o Parameters( [Integer arg1] )
Access the actual parameter values from within the currently executing OScript function.
 o Point( Integer arg1, Integer arg2 )
Deprecated. Construct a Point value from two coordinates.
 o PointH( Point arg1 )
Deprecated. Return the H coordinate from the specified point.
 o PointV( Point arg1 )
Deprecated. Return the V coordinate from the specified point.
 o Type( Dynamic arg1 )
Returns the datatype number corresponding to the type of the given value.

Class Attributes

 o BooleanType
 Integer BooleanType

A constant indicating the datatype number of the datatype Boolean.

 o BytesType
 Integer BytesType

A constant indicating the datatype number of the datatype Bytes.

 o DateType
 Integer DateType

A constant indicating the datatype number of the datatype Date.

 o DynamicType
 Integer DynamicType

A constant indicating the datatype number of the pseudo-datatype Dynamic.

 o ErrorType
 Integer ErrorType

A constant indicating the datatype number of the datatype Error.

 o ExternType
 Integer ExternType

A constant indicating the datatype number of the datatype Extern.

 o False
 Boolean False

A constant indicating the Boolean constant FALSE.

 o IntegerType
 Integer IntegerType

A constant indicating the datatype number of the datatype Integer.

 o ListType
 Integer ListType

A constant indicating the datatype number of the datatype List.

 o ObjectType
 Integer ObjectType

A constant indicating the datatype number of the datatype Object.

 o ObjRefType
 Integer ObjRefType

A constant indicating the datatype number of the datatype ObjRef.

 o PointType
 Integer PointType

A constant indicating the datatype number of the datatype Point.

 o RealType
 Integer RealType

A constant indicating the datatype number of the datatype Real.

 o ScriptType
 Integer ScriptType

A constant indicating the datatype number of the datatype Script.

 o StringType
 Integer StringType

A constant indicating the datatype number of the datatype String.

 o True
 Boolean True

A constant indicating the Boolean value TRUE.

 o Undefined
 Undefined Undefined

A constant indicating the special value Undefined, which is of datatype Undefined.

 o UndefinedType
 Integer UndefinedType

A constant indicating the datatype number of the datatype Undefined.

 o VoidType
 Integer VoidType

A constant indicating the datatype number of the datatype void.

Class Methods

 o DatatypeName
 String DatatypeName(
               Integer typeNumber )

For a type number, returns a String containing the corresponding type name. If there is no loaded type, then Undefined is returned.

Parameters:
typeNumber  -  The datatype number.
Returns:
A String containing the name of the type specified by typeNumber. If the specified type number does not correspond to a loaded type, this will return Undefined.

This is intended to be used for debugging purposes and in conjunction with Core.Type().

Here is an example:

	String	x
	echo( DatatypeName( Type( x ) ) )

The output from the example is:

	String
 o Echo
 Void Echo(
        [Dynamic firstValue],
        ... )

Converts arguments to a string display format and emits the result to the debug/log output with a level of INFO. This function terminates its output with a newline. If no arguments are specified, then only a newline is emitted. A maximum of 127 arguments can be passed. This method is an alias of EchoInfo.

Parameters:
firstValue  -  First value to be echoed/logged.
Returns:
Undefined
 o EchoDebug
 Void EchoDebug(
        [Dynamic firstValue],
        ... )

Converts arguments to a string display format and emits the result to the debug/log output with a level of DEBUG. This function terminates its output with a newline. If no arguments are specified, then only a newline is emitted. A maximum of 127 arguments can be passed.

Parameters:
firstValue  -  First value to be echoed/logged.
Returns:
Undefined
 o EchoError
 Void EchoError(
        [Dynamic firstValue],
        ... )

Converts arguments to a string display format and emits the result to the debug/log output with a level of ERROR. This function terminates its output with a newline. If no arguments are specified, then only a newline is emitted. A maximum of 127 arguments can be passed.

Parameters:
firstValue  -  First value to be echoed/logged.
Returns:
Undefined
 o EchoInfo
 Void EchoInfo(
        [Dynamic firstValue],
        ... )

Converts arguments to a string display format and emits the result to the debug/log output with a level of INFO. This function terminates its output with a newline. If no arguments are specified, then only a newline is emitted. A maximum of 127 arguments can be passed.

Parameters:
firstValue  -  First value to be echoed/logged.
Returns:
Undefined
 o EchoStamp
 Void EchoStamp(
        Boolean enable )

Enables/disables a timestamp prefix for all Echo output. When enabled, a timestamp will be prepended to all Echo, EchoError, EchoDebug, and EchoWarn statements in the format "mm/dd/YYY HH:MM:SS [ssss] ", where ssss is the current system tick count in microseconds.

Parameters:
enable  -  True to enable the timestamp, false to disable.
Returns:
Undefined
 o EchoWarn
 Void EchoWarn(
        [Dynamic firstValue],
        ... )

Converts arguments to a string display format and emits the result to the debug/log output with a level of WARN. This function terminates its output with a newline. If no arguments are specified, then only a newline is emitted. A maximum of 127 arguments can be passed.

Parameters:
firstValue  -  First value to be echoed/logged.
Returns:
Undefined
 o GetFeatures
 List GetFeatures(
        Dynamic firstValue,
        [Boolean dummy] )

Internal use only.

Parameters:
firstValue  -  First value.
dummy  -  Unused.
Returns:
A list.
 o IsDefined
 Boolean IsDefined(
              Dynamic testValue )

Determines whether a value is not Undefined.

Parameters:
testValue  -  The value to evaluate.
Returns:
FALSE if the value is Undefined, TRUE otherwise.

Note that this will return TRUE for values of type Error.

 
 o IsError
 Boolean IsError(
             Dynamic testValue,
            [Error compareValue] )

Determines whether a value is of datatype Error and, if so, optionally tests equality against a second error value if compareValue is specified.

Parameters:
testValue  -  Value to test.
compareValue  -  Value to compare.
Returns:
If called with one argument, then this function returns TRUE if the type of the argument is Error. If called with two arguments, then this returns TRUE if both arguments are of type Error and are identical.
 o IsFeature
 Boolean IsFeature(
              Dynamic object,
              Dynamic feature )

Indicates whether a value has the given feature. Note that this function applies to any datatype that can be dotted (e.g., Record, Assoc, Object) and it performs the appropriate type-specific function.

Parameters:
object  -  Object-like value
feature  -  Feature
Returns:
TRUE if the object has the specified feature, FALSE otherwise.

This function has a type-specific equivalent function for most datatypes. The following table illustrates these equivalents:

Datatype    Type-specific function.
Assoc   

Assoc.IsKey()

Record    Recarray.IsColumn()
ObjRef    OS.IsFeature()
Frame    Frame.HasSlot()

Here is an example:

	Assoc	a = Assoc.CreateAssoc()
	a.someKey = "Hello"
	if IsFeature( a, "someKey" )
		echo( "Yes" )
	else
		echo( "No" )
	end

The output from the example is:

	Yes
 
 o IsInvokable
 Boolean IsInvokable(
               Dynamic testValue )

Indicates whether the specified value can be invoked. Note that currently, only Script values are invokable.

Parameters:
testValue  -  Value to examine for invokability.
Returns:
TRUE if the value can be invoked. FALSE otherwise.
 o IsNotError
 Boolean IsNotError(
               Dynamic testValue,
              [Error compareValue] )

Determines whether a value is of datatype Error and optionally compares two error values for equality. If compareValue is specified, then it is compared with testValue.

Parameters:
testValue  -  Value to test
compareValue  -  Value to compare
Returns:
If a single argument is specified, this returns FALSE if testValue is of datatype Error. If both arguments are specified, this will return FALSE if testValue is of datatype Error and is equal to compareValue. This function will return TRUE otherwise.
 o IsNotSet
 Boolean IsNotSet(
              Dynamic testValue )

Deprecated. Determines whether a value is the special pseudo-value NotSet. This value is a special value used in conjunction with Assoc. See Assoc.NotSetValue() for more information.

Parameters:
testValue  -  Value to evaluate
Returns:
FALSE if the value is the special value returned by Assoc.NotSetValue(), TRUE otherwise.
 o IsObject
 Boolean IsObject(
              Dynamic testValue )

Determines whether a value is of datatype Object.

Parameters:
testValue  -  Value to evaluate
Returns:
TRUE if the value is of datatype Object, FALSE otherwise.
 o IsSet
 Boolean IsSet(
            Dynamic testValue )

Deprecated. Determines whether a value is not the special pseudo-value NotSet. This value is a special value used in conjunction with Assoc. See Assoc.NotSetValue() for more information.

Parameters:
testValue  -  Value to evaluate
Returns:
TRUE if the value is not the special value returned by Assoc.NotSetValue(), FALSE otherwise.
 o IsUndefined
 Boolean IsUndefined(
               Dynamic testValue )

Determines whether a value is the special value Undefined.

Parameters:
testValue  -  Value to evaluate.
Returns:
TRUE if the value is Undefined, FALSE otherwise.
 o Length
 Integer Length(
             Dynamic value )

Returns the length of the specified value.

Parameters:
value  -  Value to return length of.
Returns:
The length of the specified value.
 o NParameters
 Integer NParameters()

Indicates the number of actual parameters passed to the current function. Useful when variable argument lists are used. Note that defaulted parameters count as parameters with respect to this function.

Returns:
The number of actual and/or defaulted parameters passed to the current function.
 o Parameters
 Dynamic Parameters(
              [Integer whichArg] )

Access the actual parameter values from within the currently executing OScript function. This is especially useful with variable argument lists, since it permits unnamed parameters to be examined.

Parameters:
whichArg  -  Index (1-based) of desired parameter
Returns:
If no index is specified, then this will return a list of the actual parameters passed to the current function. If an index is specified, then the parameter with the given index will be returned. If an out-of-bounds index is specified, this function will return Undefined.

Here is an example:

	function void main()
		joe( 1 )
		joe( 1, 2 )
		joe( 1, 2, 3 )
	end

	function void joe( Integer a, Integer b = 5, ... )
		echo( "NParameters()=", NParameters() )
		echo( "Parameters()=", Parameters() )
		echo( "Parameters( 3 )=", Parameters( 3 ) )
		echo()
	end

The output from the example is:

	NParameters()=2
	Parameters()={1,5}
	Parameters( 3 )=?

	NParameters()=2
	Parameters()={1,2}
	Parameters( 3 )=?

	NParameters()=3
	Parameters()={1,2,3}
	Parameters( 3 )=3
 o Point
 Point Point(
          Integer hCoord,
          Integer vCoord )

Deprecated. Construct a Point value from two coordinates. Note that the coordinate values must be between -32768 and +32767.

Parameters:
hCoord  -  The H coordinate
vCoord  -  The V coordinate
Returns:
A Point value consisting of the specified coordinates.
 o PointH
 Integer PointH(
             Point somePoint )

Deprecated. Return the H coordinate from the specified point.

Parameters:
somePoint  -  Point value from which the H coordinate is to be extracted.
Returns:
The H coordinate of the specified point.
 o PointV
 Integer PointV(
             Point somePoint )

Deprecated. Return the V coordinate from a Point value.

Parameters:
somePoint  -  Point value from which the V coordinate is to be extracted.
Returns:
The V coordinate of the specified point.
 o Type
 Integer Type(
            Dynamic testValue )

Returns the datatype number indicating the type of the given value.

Parameters:
testValue  -  Value for which the corresponding type number is returned.
Returns:
The datatype number for the specified value.

Here is an example:

	String	x
	echo( Type( x ) )
	echo( DatatypeName( Type( x ) ) )

The output from the example is:

	-1
	String