Carapace

Core Language

function name description
class create a scripted class definition
classInfo return information about a class definition
function declare a script function
defun define a script function or method
local declare one or more variables which are local in scope to the current script function or method
global declare one or more variables which are global in scope
create create an object
createAux create an object allowing the type of object to be determined at runtime
getInterface get a given interface for an object
. (dot operator) the dot operator is used to access object properties and to invoke object methods
export export a global variable so that child threads inherit a copy of the value
isDefined test if the global variable is defined
isFunction test if the supplied Symbol represents a function
isClass test if the supplied Symbol represents a class
join join a list of objects together
length calculate the length of the argument - can work on multiple object types
load load a package of script definitions
loadLibrary load a dynamic library and register the class and function definitions it contains
print print the arguments, each on a new line
printAux print the arguments with no newlines added
printStackFrames print the evaluation stack frames -- useful for debugging scripts
reverse reverse the argument - works on multiple object types
scramble scramble the supplied text
unscramble unscramble the supplied text
typeOf return the type of the argument
faceOf return the interface no. of the argument
isEmpty determine if the argument is empty -- many different data types have a sensible value for 'empty'


class

Create a scripted class definition. The use of this function is described on the Object Definition page. in


classInfo

Return information about a class -- this is returned as a list with the following entries:

  1. class name
  2. class major version
  3. class minor version
  4. (repeated for each interface) list containing:
    1. interface name
    2. interface prog id
    3. interface major version
    4. interface minor version
    5. flag determining if the interface is creatable


function

Declare a script function. This is discussed further on the Script Function Definition page.

Arguments:

returnTypeSymbol
fnNameSymbol
parametersList

Return type: the empty List () is returned.


defun

Define a script function or method. This is discussed further on the Script Function Definition page.


local

Declare one or more variables which are local in scope to the current script function or method. Note that Carapace requires you to declare each variable used within a script function. If you attempt to use a variable you haven't declared, an Error will be thrown.

Arguments:

It takes 1 or more two-element Lists where each list is of the form:

    ( variableName  variableClass )
Both variableName and variableClass are symbols.

Note that the variableClass must have already been declared -- eg. by loading a script which declares the class.

Return type: the empty List () is returned.


global

Declare one or more variables which are global in scope. Note that Carapace requires you to declare each global variable. If you attempt to use a global variable you haven't declared, an Error will be thrown.

Arguments:

It takes 1 or more two-element Lists where each list is of the form:

    ( globalVariableName  variableClass )
Both globalVariableName and variableClass are symbols, and globalVariableName must start with two colons ::

Note that the variableClass must have already been declared -- eg. by loading a script which declares the class.

Return type: the empty List () is returned.


create

Create an object -- this is used to create both built-in and script objects. This is a lazy function in that it doesn't evaluate its first argument.

Arguments:

objectTypeNameSymbol
...further arguments are dependent on the object being created

Return type: the newly created object is returned.


createAux

Create an object allowing the type of object to be determined at runtime. The value of the first argument is a string which names the object type to be made.

Arguments:

objTypeSymbol

Return type: the newly created object is returned.


getInterface

Get a given interface for an object. The interface can be identified by its name, its Guid or its number.

Arguments:

objObject
interfaceNameOrIdString, Integer, Guid

Return type: the new interface is returned.


. (dot operator)

The dot operator is used to access object properties and to invoke object methods. For further details, see the Carapace Script page.


export

Export a global variable so that child threads inherit a copy of the value.

The complete list of globals exported from this thread is held in the global list ::ExportedGlobals.

Arguments:

This takes one or more arguments, each of which is a Symbol which is the name of the variable to export.

globalVariableNameSymbol
...further symbols

Return type: the empty List () is returned.


isDefined

Test if the variable is defined.

Arguments:

nameSymbol

Return type: if the symbol is defined, the Symbol which is the variable's type otherwise the empty List () is returned.


isFunction

Test if the supplied Symbol represents a function.

Arguments:

nameSymbol

Return type: if the symbol is a function, the Symbol true otherwise the empty List () is returned.


isClass

Test if the supplied Symbol represents a class.

Arguments:

nameSymbol

Return type: if the symbol is a class, the Symbol true otherwise the empty List () is returned.


join

Join a list of strings together.

Arguments:

stringsList

Return type: String


length

Calculate the length of the argument - can work on multiple object types.

Arguments:

objObject

Return type: Integer


load

Load a package of script definitions. If an optional second argument of the empty List () is supplied, then the expressions in the file are not evaluated, and the result of the load is the List of expressions is returned.

Arguments:

filenameString
evaluate optionalObject

Return type: Object - the value returned is the result evaluating the final expression in the package.


loadLibrary

Load a dynamic library and register the class and function definitions it contains.

Arguments:

filenameString

Return type: the empty List () is returned.


print

Print the arguments, each on a new line.

Arguments:

This takes a variable number of arguments of any type.

Return type: the empty List () is returned.


printAux

Print the arguments with no newlines added.

Arguments:

This takes a variable number of arguments of any type.

Return type: the empty List () is returned.


printStackFrames

Print the evaluation stack frames -- useful for debugging scripts. The supplied frameName is one of the following values:

Arguments:

frameNameString

Return type: the empty List () is returned.


reverse

Reverse the argument - works the following types:

Arguments:

objone of the above types

Return type: returns an object of the same type as the supplied argument


scramble

Scramble the supplied text. This modifies the first argument.

Arguments:

dataBinary
keyString

Return type: the empty List () is returned.


unscramble

Unscramble the supplied text. This modifies the first argument.

Arguments:

dataBinary
keyString

Return type: the empty List () is returned.


typeOf

Return the type of the argument. The supplied argument can be of any type.

Arguments:

objObject

Return type: String

This function can also be used to test the type of the argument -- ie. it acts as a predicate if the String name of the type expected is also supplied:

Arguments:

objObject
expectedTypeString

Return type: Object


faceOf

Return the interface no. of the argument. The supplied argument can be of any type.

Arguments:

objObject

Return type: the empty List () is returned.


isEmpty

Determine if the argument is empty -- many different data types have a sensible value for 'empty' as follows:

data typeempty value
Integer0
Real0.0
String""
Binary0x""
Unknowncontains a NULL IUnknown pointer
Dispatchcontains a NULL IDispatch pointer

Arguments:

objObject

Return type: the Symbol true or the empty List () is returned.


Contents Index Current topic: functions Related topics: objects