Core runtime library providing primitive types (Bool, Byte, Char, Int, Float, String), the Ref wrappers and array helpers, and system utilities (console, files, threads, sockets). Collections are not here: they are in gen_collect.obl. Every Objeck program links against this bundle automatically via lang.obl.
Runtime
Provides access to runtime system
Operations
- Assert
- ClearError
- Command
- CommandOutput
- Copy
- Exit
- GetEnvironmentVariable
- GetError
- GetErrorKind
- GetInstallDir
- GetLastError
- GetLibraryDir
- GetPlatform
- GetProcessId
- GetProperty
- GetTempDir
- GetTime
- GetUserDir
- GetUuid
- GetVersion
- HasEnvironmentVariable
- HasError
- HasProperty
- IsProcessAlive
- Raise
- RaiseSignal
- SetEnvironmentVariable
- SetLocale
- SetProperty
- SetSignal
- TestAddressOf
Assert # function
Asserts runtime value to be true. If false, program exits with stack trace.
function : Assert(assert:Bool) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| assert | Bool | value to assert |
ClearError # function
Forgets the recorded error, so HasError is false until the next recovery
function : ClearError() ~ NilCommand # function
Executes a system command
function : Command(c:System.String) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| c | String | system command |
Return
| Type | Description |
|---|---|
| Int | command status code |
CommandOutput # function
Executes a system command
function : CommandOutput(c:System.String) ~ CommandOutputParameters
| Name | Type | Description |
|---|---|---|
| c | String | system command |
Return
| Type | Description |
|---|---|
| CommandOutput | output from command |
CommandOutput # function
Executes a system command
function : CommandOutput(c:System.String, e:String[]) ~ CommandOutputParameters
| Name | Type | Description |
|---|---|---|
| c | String | system command |
| e | String | array of environment variables |
Return
| Type | Description |
|---|---|
| CommandOutput | output from command |
Copy # function
Copies data between two byte arrays
function : Copy(dest:Byte[], dest_offset:Int, src:Byte[], src_offset:Int, len:Int) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| dest | Byte | destination array |
| dest_offset | Int | destination array copy offset |
| src | Byte | source array |
| src_offset | Int | source array copy offset |
| len | Int | number of bytes to copy |
Return
| Type | Description |
|---|---|
| Bool | true if successful, false otherwise |
Copy # function
Copies data between two character arrays
function : Copy(dest:Char[], dest_offset:Int, src:Char[], src_offset:Int, len:Int) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| dest | Char | destination array |
| dest_offset | Int | destination array copy offset |
| src | Char | source array |
| src_offset | Int | source array copy offset |
| len | Int | number of characters to copy |
Return
| Type | Description |
|---|---|
| Bool | true if successful, false otherwise |
Copy # function
Copies data between two integer arrays
function : Copy(dest:Int[], dest_offset:Int, src:Int[], src_offset:Int, len:Int) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| dest | Int | destination array |
| dest_offset | Int | destination array copy offset |
| src | Int | source array |
| src_offset | Int | source array copy offset |
| len | Int | number of values to copy |
Return
| Type | Description |
|---|---|
| Bool | true if successful, false otherwise |
Copy # function
Copies data between two Base arrays
function : Copy(dest:Base[], dest_offset:Int, src:Base[], src_offset:Int, len:Int) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| dest | Base | destination array |
| dest_offset | Int | destination array copy offset |
| src | Base | source array |
| src_offset | Int | source array copy offset |
| len | Int | number of values to copy |
Return
| Type | Description |
|---|---|
| Bool | true if successful, false otherwise |
Copy # function
Copies data between two Compare arrays
function : Copy(dest:Compare[], dest_offset:Int, src:Compare[], src_offset:Int, len:Int) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| dest | Compare | destination array |
| dest_offset | Int | destination array copy offset |
| src | Compare | source array |
| src_offset | Int | source array copy offset |
| len | Int | number of values to copy |
Return
| Type | Description |
|---|---|
| Bool | true if successful, false otherwise |
Copy # function
Copies data between two float arrays
function : Copy(dest:Float[], dest_offset:Int, src:Float[], src_offset:Int, len:Int) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| dest | Float | destination array |
| dest_offset | Int | destination array copy offset |
| src | Float | source array |
| src_offset | Int | source array copy offset |
| len | Int | number of values to copy |
Return
| Type | Description |
|---|---|
| Bool | true if successful, false otherwise |
Exit # function
Causes the executing program to halt
function : Exit(code:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| code | Int | exit code |
GetEnvironmentVariable # function
Fetches a runtime environment variable.
function : GetEnvironmentVariable(key:String) ~ StringParameters
| Name | Type | Description |
|---|---|---|
| key | String | variable key |
Return
| Type | Description |
|---|---|
| String | runtime environment variable |
GetError # function
The message of the runtime error a ?-> (Try) region on this thread last recovered from, e.g. "Divide by zero"
function : GetError() ~ StringReturn
| Type | Description |
|---|---|
| String | the message, or Nil if none is recorded |
GetErrorKind # function
The kind of the runtime error a ?-> (Try) region on this thread last recovered from
function : GetErrorKind() ~ ErrorKindReturn
| Type | Description |
|---|---|
| ErrorKind | the kind, or NONE if none is recorded |
GetInstallDir # function
Returns the installation directory
function : GetInstallDir() ~ StringReturn
| Type | Description |
|---|---|
| String | installation directory |
GetLastError # function
The error a ?-> (Try) region on this thread last recovered from: the one raised, or for a runtime error a NilError, IndexError, DivideByZeroError, CastError or RuntimeError
function : GetLastError() ~ ErrorReturn
| Type | Description |
|---|---|
| Error | the error, or Nil if none is recorded |
GetLibraryDir # function
Returns the library directory
function : GetLibraryDir() ~ StringReturn
| Type | Description |
|---|---|
| String | installation directory |
GetPlatform # function
Returns an OS platform string
function : GetPlatform() ~ StringReturn
| Type | Description |
|---|---|
| String | OS platform string |
GetProcessId # function
Gets this process's id, as the operating system knows it
function : GetProcessId() ~ IntReturn
| Type | Description |
|---|---|
| Int | process id |
GetProperty # function
Fetches a runtime property. System properties include: 'user_dir', temp_dir and 'install_dir'.
function : GetProperty(key:String) ~ StringParameters
| Name | Type | Description |
|---|---|---|
| key | String | property key |
Return
| Type | Description |
|---|---|
| String | runtime property |
GetTempDir # function
Returns the system's temporary directory
function : GetTempDir() ~ StringReturn
| Type | Description |
|---|---|
| String | system's temporary directory |
GetTime # function
Returns the current time
function : GetTime(gmt:Bool) ~ Time.DateParameters
| Name | Type | Description |
|---|---|---|
| gmt | Bool | true of time is in GMT, false for local time zone |
Return
| Type | Description |
|---|---|
| Time.Date | current time |
GetUserDir # function
Returns the current user's working directory
function : GetUserDir() ~ StringReturn
| Type | Description |
|---|---|
| String | current user's working directory |
GetUuid # function
Generates a RFC 4122 version-4 UUID string
function : GetUuid() ~ StringReturn
| Type | Description |
|---|---|
| String | UUID string |
GetVersion # function
Returns the package version string
function : GetVersion() ~ StringReturn
| Type | Description |
|---|---|
| String | package version string |
HasEnvironmentVariable # function
Checks if an environment variable exists
function : HasEnvironmentVariable(key:String) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| key | String | variable key |
Return
| Type | Description |
|---|---|
| Bool | true if it exists, false otherwise |
HasError # function
Whether a ?-> (Try) region on this thread has recovered from a runtime error since the last ClearError
function : HasError() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if an error is recorded |
HasProperty # function
Checks if a property exists
function : HasProperty(key:String) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| key | String | property key |
Return
| Type | Description |
|---|---|
| Bool | true if it exists, false otherwise |
IsProcessAlive # function
Whether a process with an id is running on this machine. A process this one may not inspect still counts as running.
function : IsProcessAlive(pid:Int) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| pid | Int | process id |
Return
| Type | Description |
|---|---|
| Bool | true if it is running |
Raise # function
Raises an error. A ?-> region on this thread recovers from it, as from a runtime error; with none, the program reports it and ends. Raising the error a handler recovered from passes it on.
function : Raise(e:Error) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| e | Error | the error |
RaiseSignal # function
Raises a system signal
function : RaiseSignal(type:Runtime->Signal) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| type | Runtime->Signal | signal type |
SetEnvironmentVariable # function
Sets a runtime environment variable
function : SetEnvironmentVariable(key:String, value:String) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| key | String | variable key |
| value | String | environment value |
SetLocale # function
Sets the runtime locale
function : SetLocale(locale:String) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| locale | String | locale string |
SetProperty # function
Sets a runtime property
function : SetProperty(key:String, value:String) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| key | String | property key |
| value | String | property value |
SetSignal # function
Sets a system signal
function : SetSignal(type:Runtime->Signal, func:(Int)~Nil) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| type | Runtime->Signal | signal type |
| func | (Int)~Nil | function handler for signal |
TestAddressOf # function
Test hook for the collector's regression tests, not for programs: the object's address as an Int, which a collection that moves the object changes. Returns 0 unless the VM runs with OBJECK_GC_TEST_HOOKS=1.
function : TestAddressOf(o:Base) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| o | Base | an object |
Return
| Type | Description |
|---|---|
| Int | the object's current address, or 0 when the hook is off |