Carapace supports the following sorts of built-in functions:
Most of the functionality within Carapace is contained within the built-in classes.
| 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 |
| 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 |
| . | 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 variable has a non-nil value |
| 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 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' |
| function name | description |
|---|---|
| break | break out of a looping construct |
| continue | continue around a loop within a looping construct |
| do | perform a sequence of commands |
| doWhile | do a sequence of commands - maybe interrupted by break or continue statements |
| for | looping construct to work down a list or along an enumerator |
| if | simple conditional test |
| cond | powerful conditional test |
| return | return a value from a script function |
| set | assign a variable to hold the reference to the argument object |
| unset | remove any assignment for the supplied variable |
| while | loop while a given condition holds |
Click here for an overview of error handling within Carapace.
| function name | description |
|---|---|
| try | show the intention to catch errors generated by the supplied expression |
| catch | catch a given class of errors |
| throw | throw an error - so it can be caught elsewhere |
| function name | description |
|---|---|
&& |
logical and |
|| |
logical or |
! |
logical not |
== |
test for equality between two objects |
!= |
test for inequality between two objects |
> |
test if one quantity is greater than another |
< |
test if one quantity is less than another |
>= |
test if one quantity is greater than or equal to another |
<= |
test if one quantity is less than or equal to another |
| function name | description |
|---|---|
| cons | construct a list by creating a new one with the supplied head and tail |
| headOf | return the first item in the list |
| tailOf | return a list of all items excluding the first in the supplied list |
| list | create a list out of the arguments |
| function name | description |
|---|---|
| apply | apply the given function to the supplied list of arguments |
| objectApply | apply the method of the given object to the supplied list of arguments |
| eval | evaluate the supplied expression |
| quote | protect the argument from evaluation |
| stop | stop the interactive parser |
| function name | description |
|---|---|
| messageBox | generate a message box containing the supplied text |
| processId | return the id of the current process |
| threadId | return the id of the current thread |
| wait | wait for one of the supplied events to be set within the supplied number of milliseconds |
| sleep | wait for the supplied number of milliseconds |
| time | return the system time |
| formattedTime | format the current, or supplied, time |
| uniqueId | generate a unique id -- unique within this process |
| system | run a system command - this could be an executable file or a batch file/shell script |
| systemInfo | return information about the particular Operating System |
| hostName | lookup the supplied host name |
| getenv | lookup the value for the supplied environment variable |
| putenv | set the value for the supplied environment variable |
| sendWindowMessage | send a Windows message to the supplied window |
| function name | description |
|---|---|
| currentDir | determine the current working directory |
| currentDrive | determine the current drive letter |
| changeDir | change to a different working directory |
| changeDrive | change to a different drive |
| chmod | change file permissions |
| makeDir | create a directory |
| removeDir | remove a directory |
| fileStatus | return information about the status of the file |
| fileVersion | return any embeddeded version information for the file |
| listFiles | list files whos names match the supplied pattern |
| listDirectories | list directories whos names match the supplied pattern |
| rename | rename a file or a directory |
| copyFile | copy a file |
| removeFile | remove a file |
| function name | description |
|---|---|
| progId | return the progId for the supplied Dispatch object |
| interfaceName | return the name for the current inteface of the supplied object |
| invoke | invoke the specified dispatch method or property |
| method | invoke the specified dispatch method |
| getProperty | get the specified dispatch property |
| putProperty | set the specified dispatch property |
| putPropertyRef | set the specified dispatch property reference |
| dllServer | register or un-register the supplied DLL COM server |
| comLink | link up matching event source/sink interfaces on the COM client and server |
| comUnlink | break the link between matching event source/sink interfaces on the COM client and server |
| function name | description |
|---|---|
| + | add two numbers |
| - | subtract two numbers |
| % | return the remainder when dividing the first integer by the second |
| * | multiply two numbers |
| / | divide two numbers |
| random | generate a random number |
| Contents | Index | Current topic: functions | Related topics: objects |