Michael Heilmann's Arcadia Ring 1
This is the documentation for Michael Heilmann's Arcadia Ring 1. Arcadia Ring 1 facilitates the creation of C programs - in particular interpreters - that are portable, maintainable, as well as safe.
Files
You can find the sources of Arcadia Ring 1 in my GitHub repository https://github.com/michaelheilmann/michaelheilmann.com. The subdirectory of Arcadia Ring 1 in the repository is here https://github.com/michaelheilmann/michaelheilmann.com/tree/main/repository/Arcadia.Ring1.
- The (sources of the) library resides in the directory https://github.com/michaelheilmann/michaelheilmann.com/tree/main/repository/Arcadia.Ring1/Library
- The (sources of) tests reside in the directory https://github.com/michaelheilmann/michaelheilmann.com/tree/main/repository/Arcadia.Ring1/Tests
- The (sources of this very documentation you are reading) documentation reside in the directory https://github.com/michaelheilmann/michaelheilmann.com/tree/main/repository/Arcadia.Ring1/Documentation
Arcadia Ring 1 supports various platforms (including but not restricted to Windows, Linux, and many more), however, we currently only officially support Windows. For instructions on how to build, test, and use Arcadia Ring 1, refer to README.md in the root folder of the repository.
Further References
Arcadia Ring 1 relies on ARMS1.
Documentation
Arcadia_BooleanValue
typedef implementation detail Arcadia_BooleanValue
Arcadia_BooleanValue_True
#define Arcadia_BooleanValue_True implementation detail
true
.
It converts to 1
in arithmetic expressions.
Arcadia_BooleanValue_False
#define Arcadia_BooleanValue_False implementation detail
false
.
It converts to 0
in arithmetic expressions.
Arcadia_ForeignProcedureValue
typedef implementation detail Arcadia_ForeignProcedureValue;
Arcadia_ForeignProcedureValue_Null
#define Arcadia_ForeignProcedureValue_Null implementation detail
((void*)0)
.
Arcadia_ForeignProcedureValue_NumberOfBits
#define Arcadia_ForeignProcedureValue_NumberOfBits implementation detail
Arcadia_ForeignProcedureValue_NumberOfBytes
#define Arcadia_ForeignProcedureValue_NumberOfBytes implementation detail
Arcadia_ForeignProcedureValue_NumberOfBits
divided by 8.
Arcadia_Integer*Value
typedef implementation detail Arcadia_IntegerSuffix Value
8
, 16
, 32
, or 64
.
Arcadia_Integer*Value_NumberOfBits
#define Arcadia_IntegerSuffix Value_NumberOfBits implementation detail
Arcadia_IntegerSuffix
occupies
where 8
, 16
, 32
, or 64
.
The value is always equal to the value of the respective Arcadia_Integer*Value_NumberOfBytes
#define Arcadia_IntegerSuffix Value_NumberOfBytes implementation detail
Arcadia_IntegerSuffix Value
occupies
where 8
, 16
, 32
, or 64
.
The value is always equal to Arcadia_IntegerSuffix Value_NumberOfBits
divided by 8.
Arcadia_Integer*Value_Minimum
#define Arcadia_IntegerSuffix Value_Minimum implementation detail
Arcadia_IntegerSuffix Value
type
where 8
, 16
, 32
, or 64
.
The following table denotes the value of the constant for the respective
Value | |
8 | -128 |
16 | -32768 |
32 | -2147483648 |
64 | -9223372036854775808 |
Arcadia_Integer*Value_Maximum
#define Arcadia_IntegerSuffix Value_Maximum implementation detail
Arcadia_IntegerSuffix Value
type
where 8
, 16
, 32
, or 64
.
The following table denotes the value of the constant for the respective
Value | |
8 | 127 |
16 | 32767 |
32 | 2147483647 |
64 | 9223372036854775807 |
Arcadia_Integer*Value_Literal
#define Arcadia_IntegerSuffix Value_Literal(x) implementation detail
Arcadia_IntegerSuffix Value
in C source code
where 8
, 16
, 32
, or 64
.
The following table denotes the expansions of the macro:
Value | |
8 | x |
16 | x |
32 | x |
64 | x##LL |
Arcadia_Natural*Value
typedef implementation detail Arcadia_NaturalSuffix Value
8
, 16
, 32
, or 64
.
Arcadia_Natural*Value_NumberOfBits
#define Arcadia_NaturalSuffix Value_NumberOfBits implementation detail
Arcadia_NaturalSuffix
occupies
where 8
, 16
, 32
, or 64
.
The value is always equal to the value of the respective Arcadia_Natural*Value_NumberOfBytes
#define Arcadia_IntegerSuffix Value_NumberOfBytes implementation detail
Arcadia_NaturalSuffix Value
occupies
where 8
, 16
, 32
, or 64
.
The value is always equal to Arcadia_NaturalSuffix Value_NumberOfBits
divided by 8.
Arcadia_Natural*Value_Minimum
#define Arcadia_NaturalSuffix Value_Minimum implementation detail
Arcadia_NaturalSuffix Value
type
where 8
, 16
, 32
, or 64
.
Value | |
8 | 0 |
16 | 0 |
32 | 0 |
64 | 0 |
Arcadia_Natural*Value_Maximum
#define Arcadia_NaturalSuffix Value_Maximum implementation detail
Arcadia_NaturalSuffix Value
type
where 8
, 16
, 32
, or 64
.
The following table denotes the value of the constant for the respective Suffix
Constant | Value |
8 | 255 |
16 | 65535 |
32 | 4294967295 |
64 | 18446744073709551615 |
Arcadia_Natural*Value_Literal
#define Arcadia_NatualSuffix Value_Literal(x) implementation detail
Arcadia_NaturalSuffix Value
in C source code
where 8
, 16
, 32
, or 64
.
The following table denotes the expansions of the macro:
Value | |
8 | x |
16 | x |
32 | x##U |
64 | x##ULL |
Arcadia_ObjectReferenceValue
Arcadia Ring 1 provides a ObjectReference type.
typedef
The Arcadia_ObjectReferenceValue
type is a pointer.
A valid value of the Arcadia_ObjectReferenceValue
is the null reference
#define Arcadia_ObjectReferenceValue_Null
#define Arcadia_ObjectReferenceValue_NumberOfBits
denotes the number of Bits of the type.
#define Arcadia_ObjectReferenceValue_NumberOfBytes
denotes the number of Bytes of the type which is usually Arcadia_ObjectReferenceValue_NumberOfBits
divided by 8.
Arcadia_Real*Value
typedef implementation detail Arcadia_RealSuffix Value
32
or 64
.
Arcadia_Real*Value_NumberOfBits
The macros in this section all include the 32
and 64
.
#define Arcadia_RealSuffix Value_NumberOfBits implementation detail
Arcadia_VoidValue
occupies
where 32
or 64
.
This is a positive multiple of 8.
Arcadia_Real*Value_NumberOfBytes
#define Arcadia_RealSuffix Value_NumberOfBytes implementation detail
Arcadia_RealSuffix Value
occupies
where 32
or 64
.
The value is always equal to Arcadia_RealSuffix Value_NumberOfBits
divided by 8.
Arcadia_Real*Value_Minimum
#define Arcadia_RealSuffix Value_Minimum implementation detail
Arcadia_RealSuffix Value
type
where 32
or 64
.
summary>
The following table denotes the value of the constant for the respective
Value | |
32 | -FLT_MAX |
64 | -DBL_MAX |
Arcadia_Real*Value_Maximum
#define Arcadia_RealSuffix Value_Maximum implementation detail
Arcadia_RealSuffix Value
type.
The following table denotes the value of the constant for the respective Suffix
Constant | Value |
32 | +FLT_MAX |
64 | +DBL_MAX |
Arcadia_Real*Value_getBits
Arcadia_NaturalBits
Arcadia_RealBits Value_getBits
(
Arcadia_Thread* thread,
Arcadia_RealBits Value self
)
Arcadia_RealSuffix Value
where 32
or 64
.
Parameters
Arcadia_Thread
object.Return value
Return the bits of the Real value as a Natural value.
Size Type
typedef implementation detail Arcadia_SizeValue
size_t
type.
Arcadia_SizeValue_NumberOfBits
#define Arcadia_SizeValue_NumberOfBits implementation detail
Arcadia_SizeValue
occupies.
This is a positive multiple of 8.
This number must one of 32 or 64, otherwise the environment is not supported by Arcadia Ring 1.
This restriction may be relaxed in future versions of Arcadia Ring 1.
Arcadia_SizeValue_NumberOfBytes
#define Arcadia_SizeValue_NumberOfBytes implementation detail
Arcadia_SizeValue
occupies.
The value is always equal to Arcadia_SizeValue
divided by 8.
Arcadia_SizeValue_Minimum
#define Arcadia_SizeValue_Minimum implementation detail
Arcadia_SizeValue
type.
Arcadia_SizeValue_Maximum
#define Arcadia_SizeValue_Maximum implementation detail
Arcadia_SizeValue
type.
Arcadia_SizeValue_Maximum
#define Arcadia_SizeValue_Literal(x) implementation detail
Arcadia_SizeValue
in C source code.
Arcadia_VoidValue
typedef implementation detail Arcadia_VoidValue
Arcadia_VoidValue_Void
.
Arcadia_VoidValue is an unsigned integral type.
Arcadia_VoidValue_Void
#define Arcadia_VoidValue_Void implementation detail
Arcadia_VoidValue
.
Arcadia_VoidValue_NumberOfBits
#define Arcadia_VoidValue_NumberOfBits implementation detail
Arcadia_VoidValue
occupies.
This is a positive multiple of 8.
Arcadia_VoidValue_NumberOfBytes
#define Arcadia_VoidValue_NumberOfBytes implementation detail
Arcadia_VoidValue
occupies.
The value is always equal to Arcadia_VoidValue
divided by 8.
Value Type
Arcadia_Value
is a tagged union of values supported by the
runtime. It consists of a tag indicating the value stored in the
union and the union of the values. The following table lists all
possible tags and their corresponding type.
Tag | Type |
Arcadia_ValueTag_Boolean | Arcadia_BooleanValue |
Arcadia_ValueTag_Integer16 | Arcadia_Integer16Value |
Arcadia_ValueTag_Integer32 | Arcadia_Integer32Value |
Arcadia_ValueTag_Integer64 | Arcadia_Integer64Value |
Arcadia_ValueTag_Integer8 | Arcadia_Integer8Value |
Arcadia_ValueTag_Natural16 | Arcadia_Natural16Value |
Arcadia_ValueTag_Natural32 | Arcadia_Natural32Value |
Arcadia_ValueTag_Natural64 | Arcadia_Natural64Value |
Arcadia_ValueTag_Natural8 | Arcadia_Natural8Value |
Arcadia_ValueTag_ObjectReference | Arcadia_ObjectReferenceValue |
Arcadia_ValueTag_Size | Arcadia_SizeValue |
Arcadia_ValueTag_Void | Arcadia_VoidValue |
For each type, Arcadia_Value
has three functions associated:
bool Arcadia_Value_is
void Arcadia_Value_set
The following table lists the valid combinations of
Boolean | boolean |
Integer16 | integer16 |
Integer32 | integer32 |
Integer64 | integer64 |
Integer8 | integer8 |
Natural16 | natural16 |
Natural32 | natural32 |
Natural64 | natural64 |
Natural8 | natural8 |
ObjectReference | objectReference |
Size | size |
Void | void |
Arcadia_Value_is
returns true
if
the Arcadia_Value
stores a value of the type corresponding to false
.
Arcadia_Value_set
assigns the Arcadia_Value
a value of the type corresponding to
Arcadia_Value_get
get the value stored in
the Arcadia_Value
. The behavior of Arcadia_Value_set
is undefined if the value does not store a value of the
type corresponding to
Status Codes
R provides a status type and symbolic constants for its values. That type denotes success or failure of program (or a part of it) as well as information on the reason for the failure.
typedef
Arcadia_Status
is a natural number type of a width of 32 Bit.
#definer Arcadia_Status_Success
is the symbolic constant of the type Arcadia_Status
has the value ((Arcadia_Status)0)
.
It denotes success and is guaranteed to be defined to the value 0
of the underlaying natural number
type of Arcadia_Status as well as to be the only symbolic constant starting with Arcadia_Status_
having
defined to that value.
Symbolic constants of the form
#definer Arcadia_Status_
where Success
provide information on failure of a program (or a part of it).
The following table denotes the value of the constant for the respective
Name | Value |
AllocationFailed | An allocation failed. |
ArgumentTypeInvalid | The type of an argument is invalid. |
ArgumentValueInvalid | The value of an argument is invalid. |
ConversionFailed | A conversion failed. |
DivisionByZero | An divions by zero was detected. |
EncodingInvalid | An encoding is invalid. |
Exists | Something exists (but should not). |
FileSystemOperationFailed | A file system operation failed. |
Initialized | Something was initialized (but should not have been initialized). |
NotExists | Something does not exist. |
NumberOfArgumentsInvalid | The number of arguments is invalid. |
OperationInvalid | An operation is invalid. |
SemanticalError | |
SyntacticalError | |
TestFailed | A test failed. This is used by the built-in tests that ensure correctness. |
TypeExists | A type exists (but should not). |
TypeNotExists | A type does not exist (but should). |
Uninitialized | Something was uninitialized (but should have been initialized). |
Status Variable
Arcadia.Ring1 provides by-thread status variable.
Arcadia_Status
Arcadia_Thread_getStatus
(
Arcadia_Thread* thread
);
gets the value of the status variable. The initial value of the status variable is Arcadia_Status_Success
.
void
Arcadia_Thread_setStatus
(
Arcadia_Thread* thread,
Arcadia_Status status
);
sets the value of the status variable to the value status
.
Jumps and Jump Targets
Arcadia.Ring1 provides non-local jumps by allowing to save and restore the C program state.
typedef
is a type of which its values are stack allocated.
void Arcadia_Thread_pushJumpTarget(Arcadia_Thread* thread, Arcadia_JumpTarget* jumpTarget);
Push a jump target on top of the jump target stack. Initially, the jump target stack is empty.
void Arcadia_Thread_popJumpTarget(Arcadia_Thread* thread);
Pop the jump target on top of the jump target stack. The jump target stack must not be empty.
void Arcadia_jump(Arcadia_Thread* thread);
Jump to the jump target on top of the jump target stack. The jump target stack must not be empty.
#define Arcadia_JumpTarget_save(jumpTarget)
Macro to save the current C program state into a jump target.
The canonical way of using Arcadia_Thread_pushJumpTarget
, Arcadia_Thread_popJumpTarget
, and
Arcadia_Thread_jump
is the following.
Arcadia_Thread_pushJumpTarget(thread, &jumpTarget);
if (Arcadia_JumpTarget_save(thread, &jumpTarget)) {
Arcadia_Thread_popJumpTarget(thread);
} else {
Arcadia_Thread_popJumpTarget(thread);
}
The if-branch is always entered at first as the Arcadia_JumpTarget_save()
at
its first invocation returns logically true. If the program at Arcadia_Thread_jump()
), then Arcadia_Thread_popJumpTarget();
and Arcadia_Thread_JumpTarget_save()
is re-evaluated and returns
logically false and Arcadia_Thread_popJumpTarget();
and
One usage example is the implementation of the Arcadia_safeExecute
function.
void Arcadia_safeExecute(Arcadia_Thread* thread, void (*f)(Arcadia_Thread*)) {
Arcadia_JumpTarget jumpTarget;
Arcadia_Thread_pushJumpTarget(thread, &jumpTarget);
if (Arcadia_Thread_JumpTarget_save(thread, &jumpTarget)) {
f();
Arcadia_Thread_popJumpTarget(thread);
}
}
Numeric functions
Arcadia_clamp*
Type
Arcadia_clampSuffix
(
Arcadia_Thread* thread,
Type value,
Type lower,
Type upper
)
The following table lists the combinations of
Integer8Value | Arcadia_Integer8Value |
Integer16Value | Arcadia_Integer16Value |
Integer32Value | Arcadia_Integer32Value |
Integer64Value | Arcadia_Integer64Value |
Natural8Value | Arcadia_Natural8Value |
Natural16Value | Arcadia_Natural16Value |
Natural32Value | Arcadia_Natural32Value |
Natural64Value | Arcadia_Natural64Value |
SizeValue | Arcadia_SizeValue |
Parameters
Arcadia_Thread
object.This function returns the value value
clamped to the range [lower, upper]
.
Errors
lower > upper
Return value
The value value
clamped to the range [lower, upper]
.
Arcadia_countLeadingZeroes*
Arcadia_SizeValue
Arcadia_countLeadingZeroesSuffix
(
Arcadia_Thread* thread,
Type value
)
The following table lists the combinations of
Integer8Value | Arcadia_Integer8Value |
Integer16Value | Arcadia_Integer16Value |
Integer32Value | Arcadia_Integer32Value |
Integer64Value | Arcadia_Integer64Value |
Natural8Value | Arcadia_Natural8Value |
Natural16Value | Arcadia_Natural16Value |
Natural32Value | Arcadia_Natural32Value |
Natural64Value | Arcadia_Natural64Value |
SizeValue | Arcadia_SizeValue |
This function returns the number of leading zeroes of the binary representation of value
.
Arcadia_Thread* thread | A pointer to the Arcadia_Thread object. |
The value. |
The number of leading zeroes.
Arcadia_countSignificandBits*
Arcadia_SizeValue
Arcadia_countSignificandBitsSuffix
(
Arcadia_Thread* thread,
Type value
)
The following table lists the combinations of
Integer8Value | Arcadia_Integer8Value |
Integer16Value | Arcadia_Integer16Value |
Integer32Value | Arcadia_Integer32Value |
Integer64Value | Arcadia_Integer64Value |
Natural8Value | Arcadia_Natural8Value |
Natural16Value | Arcadia_Natural16Value |
Natural32Value | Arcadia_Natural32Value |
Natural64Value | Arcadia_Natural64Value |
SizeValue | Arcadia_SizeValue |
This function returns the number of significand Bits of the binary representation of value
.
Arcadia_Thread* thread | A pointer to the Arcadia_Thread object. |
The value. |
The number of significand Bits.
Arcadia_hash*
Arcadia_SizeValue
Arcadia_hashSuffix
(
Arcadia_Thread* thread,
Type x
)
The following table lists the combinations of
BooleanValue | Arcadia_BooleanValue |
ForeignProcedureValue | Arcadia_ForeignProcedureValue |
Integer8Value | Arcadia_Integer8Value |
Integer16Value | Arcadia_Integer16Value |
Integer32Value | Arcadia_Integer32Value |
Integer64Value | Arcadia_Integer64Value |
Natural8Value | Arcadia_Natural8Value |
Natural16Value | Arcadia_Natural16Value |
Natural32Value | Arcadia_Natural32Value |
Natural64Value | Arcadia_Natural64Value |
Real32Value | Arcadia_Real32Value |
Real64Value | Arcadia_Real64Value |
SizeValue | Arcadia_SizeValue |
VoidValue | Arcadia_VoidValue |
Parameters
Arcadia_Thread
object.Return value
Return hash of x
.
Arcadia_isPowerOfTwo*
Arcadia_BooleanValue
Arcadia_isPowerOfTwoSuffix
(
Arcadia_Thread* thread,
Type x
)
The following table lists the combinations of
Integer8Value | Arcadia_Integer8Value |
Integer16Value | Arcadia_Integer16Value |
Integer32Value | Arcadia_Integer32Value |
Integer64Value | Arcadia_Integer64Value |
Natural8Value | Arcadia_Natural8Value |
Natural16Value | Arcadia_Natural16Value |
Natural32Value | Arcadia_Natural32Value |
Natural64Value | Arcadia_Natural64Value |
SizeValue | Arcadia_SizeValue |
Parameters
Arcadia_Thread
object.Return value
Arcadia_BooleanValue_True
if the value x/
is a power of two.
Arcadia_BooleanValue_False
otherwise.
Arcadia_maximum*
Type
Arcadia_maximumSuffix
(
Arcadia_Thread* thread,
Type x,
Type y
)
The following table lists the combinations of
Integer8Value | Arcadia_Integer8Value |
Integer16Value | Arcadia_Integer16Value |
Integer32Value | Arcadia_Integer32Value |
Integer64Value | Arcadia_Integer64Value |
Natural8Value | Arcadia_Natural8Value |
Natural16Value | Arcadia_Natural16Value |
Natural32Value | Arcadia_Natural32Value |
Natural64Value | Arcadia_Natural64Value |
SizeValue | Arcadia_SizeValue |
Parameters
Arcadia_Thread
object.Return value
Return the maximum of x
and y
.
Arcadia_minimum*
Type
Arcadia_minimumSuffix
(
Arcadia_Thread* thread,
Type x,
Type y
)
The following table lists the combinations of
Integer8Value | Arcadia_Integer8Value |
Integer16Value | Arcadia_Integer16Value |
Integer32Value | Arcadia_Integer32Value |
Integer64Value | Arcadia_Integer64Value |
Natural8Value | Arcadia_Natural8Value |
Natural16Value | Arcadia_Natural16Value |
Natural32Value | Arcadia_Natural32Value |
Natural64Value | Arcadia_Natural64Value |
SizeValue | Arcadia_SizeValue |
Parameters
Arcadia_Thread
object.Return value
Return the minimum of x
and y
.
Arcadia_nextPowerOfTwoGreaterThan*
Type
Arcadia_nextPowerOfTwoGreaterThanSuffix
(
Arcadia_Thread* thread,
Type x
)
The following table lists the combinations of
Integer8Value | Arcadia_Integer8Value |
Integer16Value | Arcadia_Integer16Value |
Integer32Value | Arcadia_Integer32Value |
Integer64Value | Arcadia_Integer64Value |
Natural8Value | Arcadia_Natural8Value |
Natural16Value | Arcadia_Natural16Value |
Natural32Value | Arcadia_Natural32Value |
Natural64Value | Arcadia_Natural64Value |
SizeValue | Arcadia_SizeValue |
Parameters
Arcadia_Thread
object.Errors
x
is not representable by the type Return value
Return the next power of two greater than x
.
Arcadia_nextPowerOfTwoGreaterThanOrEqualTo*
Type
Arcadia_nextPowerOfTwoGreaterThanOrEqualToSuffix
(
Arcadia_Thread* thread,
Type x
)
The following table lists the combinations of
Integer8Value | Arcadia_Integer8Value |
Integer16Value | Arcadia_Integer16Value |
Integer32Value | Arcadia_Integer32Value |
Integer64Value | Arcadia_Integer64Value |
Natural8Value | Arcadia_Natural8Value |
Natural16Value | Arcadia_Natural16Value |
Natural32Value | Arcadia_Natural32Value |
Natural64Value | Arcadia_Natural64Value |
SizeValue | Arcadia_SizeValue |
Parameters
Arcadia_Thread
object.Errors
x
is not representable by the type Return value
Return the next power of two greater than or equal to x
.
Arcadia_quotientRemainder*
void
Arcadia_quotientRemainderSuffix
(
Arcadia_Thread* thread,
Type dividend,
Type divisor,
Type * quotient,
Type * remainder
)
The following table lists the combinations of
Integer8Value | Arcadia_Integer8Value |
Integer16Value | Arcadia_Integer16Value |
Integer32Value | Arcadia_Integer32Value |
Integer64Value | Arcadia_Integer64Value |
Natural8Value | Arcadia_Natural8Value |
Natural16Value | Arcadia_Natural16Value |
Natural32Value | Arcadia_Natural32Value |
Natural64Value | Arcadia_Natural64Value |
SizeValue | Arcadia_SizeValue |
This function computes the quotient
and the remainder
.
The quotient is stored in *quotient
and the divisor is stored in *remainder
.
Parameters
Arcadia_Thread
object.Errors
quotient
or remainder
is zero.Arcadia_safeAdd*
void
Arcadia_safeAddSuffix
(
Arcadia_Thread* thread,
Type augend,
Type addend,
Type * sumHigh,
Type * sumLow
)
The following table lists the combinations of
Natural16Value | Arcadia_Natural16Value |
Natural32Value | Arcadia_Natural32Value |
Natural64Value | Arcadia_Natural64Value |
Natural8Value | Arcadia_Natural8Value |
SizeValue | Arcadia_SizeValue |
Arcadia_Thread
object.Arcadia_safeMultiply*
void
Arcadia_safeMultiplySuffix
(
Arcadia_Thread* thread,
Type x,
Type y
)
The following table lists the combinations of
Natural8Value | Arcadia_Natural8Value |
Natural16Value | Arcadia_Natural16Value |
Natural32Value | Arcadia_Natural32Value |
Natural64Value | Arcadia_Natural64Value |
SizeValue | Arcadia_SizeValue |
Parameters
Arcadia_Thread
object.Return value
Return the maximum of x
and y
.
Time and Date Functions
Arcadia_getTickCount
Arcadia_Natural64Value
Arcadia_getTickCount
(
Arcadia_Thread* thread
)
Parameters
Arcadia_Thread
object.Return value
The time, in milliseconds, since an unspecified momentn in the past.
Unicode Functions
Arcadia_isUtf8
Arcadia_BooleanValue
Arcadia_isUtf8
(
Arcadia_Thread* thread,
const void* bytes,
Arcadia_SizeValue numberOfBytes,
Arcadia_SizeValue* numberOfSymbols
)
Parameters
Arcadia_Thread
object.numberOfBytes
Bytes.bytes
.bytes
.
If this function terminates and this pointer is not null, the variable is assigned the number of symbols decoded successfully so far.
Return value
Arcadia_BooleanValue_True
if the sequence of numberOfBytes
Bytes pointed to by bytes
is an UTF-8 sequence of Bytes.
Arcadia_BooleanValue_False
otherwise.
Arcadia_Value
Arcadia_Value
is a tagged union of values supported by the
runtime. It consists of a tag indicating the value stored in the
union and the union of the values. The following table lists all
possible tags and their corresponding type.
Tag | Type |
Arcadia_ValueTag_Atom n | Arcadia_AtomValue |
Arcadia_ValueTag_Boolean | Arcadia_BooleanValue |
Arcadia_ValueTag_Integer16 | Arcadia_Integer16Value |
Arcadia_ValueTag_Integer32 | Arcadia_Integer32Value |
Arcadia_ValueTag_Integer64 | Arcadia_Integer64Value |
Arcadia_ValueTag_Integer8 | Arcadia_Integer8Value |
Arcadia_ValueTag_Natural16 | Arcadia_Natural16Value |
Arcadia_ValueTag_Natural32 | Arcadia_Natural32Value |
Arcadia_ValueTag_Natural64 | Arcadia_Natural64Value |
Arcadia_ValueTag_Natural8 | Arcadia_Natural8Value |
Arcadia_ValueTag_ObjectReference | Arcadia_ObjectReferenceValue |
Arcadia_ValueTag_Real32 | Arcadia_Real32Value |
Arcadia_ValueTag_Real64 | Arcadia_Real64Value |
Arcadia_ValueTag_Size | Arcadia_SizeValue |
Arcadia_ValueTag_Type | Arcadia_TypeValue |
Arcadia_ValueTag_Void | Arcadia_VoidValue |
For each type, Arcadia_Value
has three functions associated:
bool Arcadia_Value_is
void Arcadia_Value_set
The following table lists the valid combinations of
Atom | atom |
Boolean | boolean |
Integer16 | integer16 |
Integer32 | integer32 |
Integer64 | integer64 |
Integer8 | integer8 |
Natural16 | natural16 |
Natural32 | natural32 |
Natural64 | natural64 |
Natural8 | natural8 |
Real32 | reall32 |
Real64 | real64 |
ObjectReference | objectReference |
Size | size |
Type | type |
Void | void |
Arcadia_Value_is
returns true
if
the Arcadia_Value
stores a value of the type corresponding to false
.
Arcadia_Value_set
assigns the Arcadia_Value
a value of the type corresponding to
Arcadia_Value_get
get the value stored in
the Arcadia_Value
. The behavior of Arcadia_Value_set
is undefined if the value does not store a value of the
type corresponding to
hash
Arcadia_Size
Arcadia_Value_hash
(
Arcadia_Process* process,
Arcadia_Value* self
);
Get the hash value of this Arcadia_Value
.
Parameters
process | A pointer to the Arcadia_Process object. |
self | A pointer to this Arcadia_Value object. |
Return value
The hash of the value of the value of thisArcadia_Value
object.
isEqualTo
Arcadia_BooleanValue
Arcadia_Value_isEqualTo
(
Arcadia_Process* process,
Arcadia_Value* self,
Arcadia_Value* other
);
Compare the value of this Arcadia_Value
object to the value of another Arcadia_Value
object.
Parameters
process | A pointer to the Arcadia_Process object. |
self | A pointer to this Arcadia_Value object. |
object | A pointer to the other Arcadia_Value object. |
Return value
Arcadia_BooleanValue_True
if the value of this Arcadia_Value
object is equal to the value of the other Arcadia_Value
object.
Arcadia_BooleanValue_False
otherwise.
isEqualTo
Arcadia_TypeValue
Arcadia_Value_isEqualTo
(
Arcadia_Process* process,
Arcadia_Value* self
);
Get thet type of the value of this Arcadia_Value
object.
Parameters
process | A pointer to the Arcadia_Process object. |
self | A pointer to this Arcadia_Value object. |
Return value
The type of the value of this Arcadia_Value
object.