Michael Heilmann's Arcadia Ring 2
This is the documentation for Michael Heilmann's Arcadia Ring 2. Arcadia Ring 2 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 2 in my GitHub repository https://github.com/michaelheilmann/michaelheilmann.com. The subdirectory of Arcadia Ring 2 in the repository is here https://github.com/michaelheilmann/michaelheilmann.com/tree/main/repository/Ring2.
- The (sources of the) library resides in the directory https://github.com/michaelheilmann/michaelheilmann.com/tree/main/repository/Ring2/Library
- The (sources of) tests reside in the directory https://github.com/michaelheilmann/michaelheilmann.com/tree/main/repository/Ring2/Tests
- The (sources of this very documentation you are reading) documentation reside in the directory https://github.com/michaelheilmann/michaelheilmann.com/tree/main/repository/Ring2/Documentation
Arcadia Ring 2 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 2 relies on Arcadia Ring 1 and Arcadia ARMS.
Documentation
Objects
Arcadia_ByteBuffer
Arcadia_ByteBuffer
represents a mutable sequence of Bytes.
This type is allocated on the heap and values of this type are referenced by Arcadia_ByteBuffer
pointers.
A Arcadia_ByteBuffer
pointer can be safely cast into a Arcadia_ObjectReferenceValue
values.
An Arcadia_ObjectReferenceValue
pointing to a Arcadia_ByteBuffer
value can be safely cast into a Arcadia_ByteBuffer
pointer.
Arcadia_ByteBuffer_create
Arcadia_ByteBuffer*
Arcadia_ByteBuffer_create
(
Arcadia_Thread* thread
)
Parameters
Arcadia_Thread
object.Errors
Return value
A pointer to the Byte buffer.
Arcadia_ByteBuffer_clear
void
Arcadia_ByteBuffer_clear
(
Arcadia_Thread* thread,
Arcadia_ByteBuffer* self
)
Parameters
Arcadia_Thread
object.Arcadia_ByteBuffer_endsWith_pn
Arcadia_BooleanValue
Arcadia_ByteBuffer_endsWith_pn
(
Arcadia_Thread* thread,
Arcadia_ByteBuffer const* self,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread
object.n
Bytes.p
.Return value
Arcadia_BooleanValue_True
if the sequence of Bytes is a suffix of this byte buffer's sequence of Bytes.
Arcadia_BooleanValue_False
otherwise.
Arcadia_ByteBuffer_startsWith_pn
Arcadia_BooleanValue
Arcadia_ByteBuffer_startsWith_pn
(
Arcadia_Thread* thread,
Arcadia_ByteBuffer* self,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread
object.n
Bytes.p
.Return value
Arcadia_BooleanValue_True
if the sequence of Bytes is a prefix of this byte buffer's sequence of Bytes.
Arcadia_BooleanValue_False
otherwise.
Arcadia_isEqualTo_pn
Arcadia_BooleanValue
Arcadia_ByteBuffer_isEqualTo_pn
(
Arcadia_Thread* thread,
Arcadia_ByteBuffer* self,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread
object.n
Bytes.p
.Return value
Arcadia_BooleanValue_True
if the sequence of Bytes is this byte buffer's sequence of Bytes.
Arcadia_BooleanValue_False
otherwise.
Arcadia_ByteBuffer_append_pn
void
Arcadia_ByteBuffer_append_pn
(
Arcadia_Thread* thread,
Arcadia_ByteBuffer* self,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread
object.n
Bytes.p
.Errors
self
is a null pointer.bytes
is a null pointer.Arcadia_ByteBuffer_prepend_pn
void
Arcadia_ByteBuffer_prepend_pn
(
Arcadia_Thread* thread,
Arcadia_ByteBuffer* self,
void const* p,
Arcadia_SizeValue n
)
Parameters
Arcadia_Thread
object.n
Bytes.p
.Errors
self
is a null pointer.bytes
is a null pointer.Arcadia_ByteBuffer_insert_pn
void
Arcadia_ByteBuffer_insert_pn
(
Arcadia_Thread* thread,
Arcadia_ByteBuffer* self,
Arcadia_SizeValue index,
void const* p,
Arcadia_SizeValue n
)
Parameters
Arcadia_Thread
object.[0,n)
where n
is the size of this Byte buffer.n
Bytes.p
.Errors
self
is a null pointer.bytes
is a null pointer.Arcadia_ByteBuffer_isEqualTo
Arcadia_BooleanValue
Arcadia_ByteBuffer_isEqualTo
(
Arcadia_Thread* thread,
Arcadia_ByteBuffer const* self,
Arcadia_ByteBuffer const* other
)
Parameters
Arcadia_Thread
object.Return value
Arcadia_BooleanValue_True
if this Byte buffer is equal to the other Byte buffer.
Arcadia_BooleanValue_False
otherwise.
Arcadia_ByteBuffer_getSize
Arcadia_SizeValue
Arcadia_ByteBuffer_getSize
(
Arcadia_Thread* thread,
Arcadia_ByteBuffer const* self
)
Parameters
Arcadia_Thread
object.Return value
The size of this Byte buffer.
Arcadia_ByteBuffer_getAt
Arcadia_Natural8Value
Arcadia_ByteBuffer_getAt
(
Arcadia_Thread* thread,
Arcadia_ByteBuffer const* self,
Arcadia_SizeValue index
)
Parameters
Arcadia_Thread
object.[0,n)
where n
is the size of this Byte buffer.Return value
The Byte value.
Arcadia_ByteBuffer_isEmpty
Arcadia_BooleanValue
Arcadia_ByteBuffer_isEmpty
(
Arcadia_Thread* thread,
Arcadia_ByteBuffer* self
)
Parameters
Arcadia_Thread
object.Return value
Arcadia_BooleanValue_True
if this Byte buffer is empty. Arcadia_BooleanValue_False
otherwise.
Errors
self
is a null pointer.Arcadia_ByteBuffer_swap
void
Arcadia_ByteBuffer_swap
(
Arcadia_Thread* thread,
Arcadia_ByteBuffer* self,
Arcadia_ByteBuffer* other
)
Parameters
Arcadia_Thread
object.Errors
self
is a null pointer.other
is a null pointer.Arcadia_FileHandle
Arcadia_FileHandle
represents a operating system file handle.
This type is allocated on the heap and values of this type are referenced by Arcadia_FileHandle
pointers.
A Arcadia_FileHandle
pointer can be safely cast into a R_ObjectReferenceValue
values.
An Arcadia_ObjectReferenceValue
pointing to a Arcadia_FileHandle
value can be safely cast into a Arcadia_FileHandle
pointer.
Arcadia_FileHandle_create
Arcadia_FileHandle*
Arcadia_FileHandle_create
(
Arcadia_Thread* thread,
Arcadia_FileSystem* fileSystem
)
Parameters
Arcadia_Thread
object.Arcadia_FileSystem
object.Return value
A pointer to the file handle.
Arcadia_FileHandle_close
void
Arcadia_FileHandle_close
(
Arcadia_Thread* thread,
Arcadia_FileHandle* self
)
Parameters
Arcadia_Thread
object.Arcadia_FileHandle_openForReading
void
Arcadia_FileHandle_openForReading
(
Arcadia_Thread* thread,
Arcadia_FileHandle* self,
Arcadia_FilePath* path
)
Parameters
Arcadia_Thread
object.Errors
self
is a null pointer.path
is a null pointer.Arcadia_FileHandle_openForWriting
void
Arcadia_FileHandle_openForWriting
(
Arcadia_FileHandle* self,
Arcadia_FilePath* path
)
Parameters
Errors
self
is a null pointer.path
is a null pointer.Arcadia_FileHandle_isClosed
Arcadia_BooleanValue
Arcadia_FileHandle_isClosed
(
Arcadia_FileHandle const* self
)
Parameters
Return value
Arcadia_BooleanValue_True
if this file handle is closed.
Arcadia_BooleanValue_False
otherwise.
Arcadia_FileHandle_isOpened
Arcadia_BooleanValue
Arcadia_FileHandle_isOpened
(
Arcadia_FileHandle const* self
)
Parameters
Return value
Arcadia_BooleanValue_True
if this file handle is opened.
Arcadia_BooleanValue_False
otherwise.
Arcadia_FileHandle_isOpenedForReading
Arcadia_BooleanValue
Arcadia_FileHandle_isOpenedForReading
(
Arcadia_FileHandle const* self
)
Parameters
Return value
Arcadia_BooleanValue_True
if this file handle is opened for reading.
Arcadia_BooleanValue_False
otherwise.
Arcadia_FileHandle_isOpenedForWriting
Arcadia_BooleanValue
Arcadia_FileHandle_isOpenedForWriting
(
Arcadia_FileHandle const* self
)
Parameters
Return value
Arcadia_BooleanValue_True
if this file handle is opened for writing.
Arcadia_BooleanValue_False
otherwise.
Arcadia_FileHandle_write
void
Arcadia_FileHandle_write
(
Arcadia_FileHandle* self,
void const* p,
Arcadia_SizeValue bytesToWrite
)
Parameters
bytesToWrite
Bytes.bytes
.Arcadia_SizeValue
variable.Success
*bytesWritten
is assigned the actual number of Bytes written.
Errors
self
is a null pointer. bytes
is a null pointer.Arcadia_FileHandle_read
void
Arcadia_FileHandle_read
(
Arcadia_FileHandle* self,
void const* bytes,
Arcadia_SizeValue bytesToRead,
Arcadia_SizeValue* bytesRead
)
Parameters
bytesToWrite
Bytes.bytes
.Arcadia_SizeValue
variable.Success
*bytesRead
is assigned the actual number of Bytes read.
The number of Bytes read is 0 if the end of the file was reached.
Errors
self
is a null pointer.bytes
is a null pointer.bytesRead
is a null pointer.Arcadia_FilePath
Arcadia_FilePath
represents a file path.
This type is allocated on the heap and values of this type are referenced by Arcadia_FilePath
pointers.
A Arcadia_FilePath
pointer can be safely cast into a Arcadia_ObjectReferenceValue
values.
An Arcadia_ObjectReferenceValue
pointing to a Arcadia_FilePath
value can be safely cast into a Arcadia_FilePath
pointer.
create
Arcadia_FilePath*
Arcadia_FilePath_create
(
Arcadia_Thread* thread
)
Parameters
Arcadia_Thread
object.Return value
A pointer to the file path.
Arcadia_FilePath_parseWindows
Arcadia_FilePath*
Arcadia_FilePath_parseWindows
(
Arcadia_Thread* thread,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread
object.numberOfBytes
Bytes.bytes
Bytes.Return value
A pointer to the file path.
Arcadi_FilePath_parseUnix
Arcadia_FilePath*
Arcadia_FilePath_parseUnix
(
Arcadia_Thread* thread,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread
object.numberOfBytes
Bytes.bytes
Bytes.Return value
A pointer to the file path.
Arcadia_FilePath_parseNative
Arcadia_FilePath*
Arcadia_FilePath_parseNative
(
Arcadia_Thread* thread,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread
object.numberOfBytes
Bytes.bytes
Bytes.Return value
A pointer to the file path.
Arcadia_FilePath_toNative
Arcadia_String*
Arcadia_FilePath_toNative
(
Arcadia_Thread* thread,
Arcadia_FilePath* self
)
Parameters
Arcadia_Thread
object.Return value
A pointer to the string.
Arcadia_FileSystem
Arcadia_FileSystem
provides access to the file system.
This type is allocated on the heap and values of this type are referenced by Arcadia_FileSystem
pointers.
A Arcadia_FileSystem
pointer can be safely cast into a Arcadia_ObjectReferenceValue
values.
An Arcadia_ObjectReferenceValue
pointing to a Arcadia_FileSystem
value can be safely cast into a Arcadia_FileSystem
pointer.
Arcadia_FileSystem_create
Arcadia_FileSystem*
Arcadia_FileSystem_create
(
Arcadia_Thread* thread
)
Parameters
Arcadia_Thread
object.Errors
Arcadia_FileSystem_getFileContents
Arcadia_ByteBuffer*
Arcadia_FileSystem_getFileContents
(
Arcadia_Thread* thread,
Arcadia_FileSystem* self,
Arcadia_FilePath* path
)
Parameters
Arcadia_Process
object.Arcadia_FileSystem
object.Return value
A pointer to a Arcadia_ByteBuffer
object with the file contents.
Errors
self
is a null pointer.path
is a null pointer.Arcadia_FileSystem_setFileContents
void
Arcadia_FileSystem_setFileContents
(
Arcadia_Thread* thread,
Arcadia_FileSystem* self,
Arcadia_FilePath* path,
Arcadia_ByteBuffer* contents
)
Parameters
Arcadia_Thread
object.Arcadia_FileSystem
object.Errors
sekf
is a null pointer.path
is a null pointer.contents
is a null pointer.Arcadia_FileSystem_regularFileExists
Arcadia_BooleanValue
Arcadia_FileSystem_regularFileExists
(
Arcadia_Thread* thread,
Arcadia_FileSystem* self,
Arcadia_FilePath* path
)
Parameters
Arcadia_Thread
object.Arcadia_FileSystem
object.Return value
Arcadia_BooleanValue_True
if the file exists and is a regular file.
Arcadia_BooleanValue_False
otherwise.
Errors
self
is a null pointer.path
is a null pointer.Arcadia_FileSystem_directoryFileExists
Arcadia_BooleanValue
Arcadia_FileSystem_directoryFileExists
(
Arcadia_Thread* thread,
Arcadia_FileSystem* self,
Arcadia_FilePath* path
)
Parameters
Arcadia_Thread
object.Arcadia_FileSystem
object.Return value
Arcadia_BooleanValue_True
if the file exists and is a directory file.
Arcadia_BooleanValue_False
otherwise.
Errors
self
is a null pointer.path
is a null pointer.Arcadia_List
Arcadia_List
represents a list of Arcadia_Value
objects.
This type is allocated on the heap and values of this type are referenced by Arcadia_List
pointers.
A Arcadia_List
pointer can be safely cast into a Arcadia_ObjectReferenceValue
values.
An Arcadia_ObjectReferenceValue
pointing to a Arcadia_List
value can be safely cast into a Arcadia_List
pointer.
Arcadia_List_clear
void
Arcadia_List_clear
(
Arcadia_Thread* thread,
Arcadia_List* self
)
Parameters
Arcadia_Process
object.Arcadia_List_create
Arcadia_List*
Arcadia_List_create
(
Arcadia_Thread* thread
)
Parameters
Arcadia_Process
object.Errors
Return value
A pointer to the Arcadia_List
value.
Arcadia_List_getAt
Arcadia_Value
Arcadia_List_getAt
(
Arcadia_Thread* thread,
Arcadia_List* self,
Arcadia_SizeValue index
)
Parameters
Arcadia_Thread
object.[0,n)
where n
is the size of this list.Errors
index
is out of bounds.Return value
The value.
Arcadia_List_getSize
Arcadia_SizeValue
Arcadia_List_getSize
(
Arcadia_Thread* thread,
Arcadia_List const* self
)
Parameters
Arcadia_Thread
object.Return value
The size of this list.
Arcadia_List_insertAt
void
Arcadia_List_insertAt
(
Arcadia_Thread* thread,
Arcadia_List* self,
Arcadia_SizeValue index,
Arcadia_Value value
)
Parameters
Arcadia_Thread
object.[0,n]
where n
is the size of thie list.Errors
index
is out of bounds.Arcadia_List_insertBack
void
Arcadia_List_insertBack
(
Arcadia_Thread* thread,
Arcadia_List* self,
Arcadia_Value value
)
Parameters
Arcadia_Thread
object.Arcadia_List_insertFront
void
Arcadia_List_insertFront
(
Arcadia_Thread* thread,
Arcadia_List* self,
Arcadia_Value value
)
Parameters
Arcadia_Thread
object.Arcadia_List_isEmpty
Arcadia_BooleanValue
Arcadia_List_isEmpty
(
Arcadia_Thread* thread,
Arcadia_List* self
)
Parameters
Arcadia_Thread
object.Return value
Arcadia_BooleanValue_True
if this list is empty. Arcadia_BooleanValue_False
otherwise.
Errors
self
is a null pointer.Arcadia_List_removeAt
void
Arcadia_List_removeAt
(
Arcadia_Thread* thread,
Arcadia_List* self,
Arcadia_SizeValue start,
Arcadia_SizeValue length
)
length
values starting with element at index start
.
Parameters
Arcadia_Thread
object.Errors
self
is a null pointer.index + length > n
where n
is the length of the list.Stack
Arcadia_Stack
represents a stack of Arcadia_Value
objects.
This type is allocated on the heap and values of this type are referenced by Arcadia_Stack
pointers.
A Arcadia_Stack
pointer can be safely cast into a Arcadia_ObjectReferenceValue
values.
An Arcadia_ObjectReferenceValue
pointing to a Arcadia_Stack
value can be safely cast into a Arcadia_Stack
pointer.
Arcadia_Stack_clear
void
Arcadia_Stack_clear
(
Arcadia_Thread* thread,
Arcadia_Stack* self
)
Parameters
Arcadia_Thread
object.Arcadia_Stack_create
Arcadia_Stack*
Arcadia_Stack_create
(
Arcadia_Thread* thread
)
Parameters
Arcadia_Thread
object.Errors
bytes
is a null pointer.Return value
A pointer to the Arcadia_Stack
value.
Arcadia_Stack_getSize
Arcadia_SizeValue
Arcadia_Stack_getSize
(
Arcadia_Thread* thread,
Arcadia_Stack const* self
)
Parameters
Arcadia_Thread
object.Return value
The size of this stack.
Arcadia_Stack_isEmpty
Arcadia_BooleanValue
Arcadia_Stack_isEmpty
(
Arcadia_Thread* thread,
Arcadia_Stack* self
)
Parameters
Arcadia_Thread
object.Return value
Arcadia_BooleanValue_True
if this stack is empty. Arcadia_BooleanValue_False
otherwise.
Errors
self
is a null pointer.Arcadia_Stack_peek
Arcadia_Value
Arcadia_Stack_peek
(
Arcadia_Thread* thread,
Arcadia_Stack* self
)
Parameters
Arcadia_Thread
object.Return value
The value.
Arcadia_Stack_pop
Arcadia_Value
Arcadia_Stack_pop
(
Arcadia_Thread* thread,
Arcadia_Stack* self
)
Parameters
Arcadia_Thread
object.Return value
The value.
Arcadia_Stack_push
void
Arcadia_Stack_push
(
Arcadia_Thread* thread,
Arcadia_Stack* self,
Arcadia_Value value
)
Parameters
Arcadia_Thread
object.Arcadia_StringBuffer
Arcadia_StringBuffer
represents a mutable UTF-8 Byte sequence.
This type is allocated on the heap and values of this type are referenced by Arcadia_StringBuffer
pointers.
A Arcadia_StringBuffer
pointer can be safely cast into a Arcadia_ObjectReferenceValue
values.
An Arcadia_ObjectReferenceValue
pointing to a Arcadia_StringBuffer
value can be safely cast into a Arcadia_StringBuffer
pointer.
Arcadia_StringBuffer_clear
void
Arcadia_StringBuffer_clear
(
Arcadia_Thread* thread,
Arcadia_StringBuffer* self
)
Parameters
Arcadia_Thread
object.Arcadia_StringBuffer_create
Arcadia_StringBuffer*
Arcadia_StringBuffer_create
(
Arcadia_Thread* thread
)
Parameters
Arcadia_Thread
object.Errors
Return value
A pointer to the Arcadia_StringBuffer
value.
Arcadia_StringBuffer_compareTo
Arcadia_Integer32Value*
Arcadia_StringBuffer_compareTo
(
Arcadia_Thread* thread,
Arcadia_StringBuffer* self,
Arcadia_Value other
)
Parameters
Arcadia_Thread
object.Arcadia.ImmutableUtf8String
, Arcadia.StringBuffer
, or Arcadia.String
.
Errors
Return value
- A negative value is returned if the string in this string buffer is lexicographically less than the other string.
- A positive value is returned if the string in this string buffer is lexicographically greater than the other string.
- If both strings are lexicographically equal, then zero is returned.
Remarks
Leta
and b
be UTF-8 strings of n and m Bytes, respectively.
Denote the i
-th Byte of a by a[i]
(given a
is not empty) and the i
-th Byte of b
by b[i]
(given that b
is not empty), respectively.
Then comparing a
and b
lexicographically means:
Let l := min(n,m)
.
If l
is 0
or a[i] = b[i]
for all i in [0, l-1]
, then
a
is lexicographically less thanb
ifn < m
a
is lexicographically greater thanb
ifn > m
a
andb
are lexicographically equal ifn = m
Otherwise there exists an i in [0, l - 1]
such that for all a[j] = b[j]
for all j < i
holds and a[i] != b[i]
.
In that case:
a
is lexicographically less thanb
ifa[i] < b[i]
a
is lexicographically greater thanb
ifa[i] > b[i]
Arcadia_StringBuffer_getNumberOfBytes
Arcadia_SizeValue
Arcadia_StringBuffer_getNumberOfBytes
(
Arcadia_Thread* thread,
Arcadia_StringBuffer self
)
Parameters
Arcadia_Thread
object.Return value
The number of Bytes in this string buffer.
Arcadia_StringBuffer_insertAt
void
Arcadia_StringBuffer_insertAt
(
Arcadia_Thread* thread,
Arcadia_StringBuffer* self,
Arcadia_SizeValue index,
Arcadia_Value value
)
Parameters
Arcadia_Thread
object.Arcadia.ImmutableByteArray
, Arcadia.ImmutableUtf8String
,
Arcadia.ByteBuffer
, Arcadia.StringBuffer
, or Arcadia.String
.
Errors
value
is not of an accepted type.index
is not within the bounds of [0,n] where n is the number of code points in this string buffer.value
is of type Arcadia.ImmutableByteArray
or Arcadia.ByteBuffer
and the Bytes are not a valid UTF-8 Byte sequence.Arcadia_StringBuffer_insertBack
void
Arcadia_StringBuffer_insertFront
(
Arcadia_Thread* thread,
Arcadia_StringBuffer* self,
Arcadia_Value value
)
Parameters
Arcadia_Thread
object.Arcadia.ImmutableByteArray
, Arcadia.ImmutableUtf8String
,
Arcadia.ByteBuffer
, Arcadia.StringBuffer
, or Arcadia.String
.
Errors
value
is not of an accepted type.value
is of type Arcadia.ImmutableByteArray
or Arcadia.ByteBuffer
and the Bytes are not a valid UTF-8 Byte sequence.Arcadia_StringBuffer_insertFront
void
Arcadia_StringBuffer_insertFront
(
Arcadia_Thread* thread,
Arcadia_StringBuffer* self,
Arcadia_Value value
)
Parameters
Arcadia_Thread
object.Arcadia.ImmutableByteArray
, Arcadia.ImmutableUtf8String
,
Arcadia.ByteBuffer
, Arcadia.StringBuffer
, or Arcadia.String
.
Errors
value
is not of an accepted type.value
is of type Arcadia.ImmutableByteArray
or Arcadia.ByteBuffer
and the Bytes are not a valid UTF-8 Byte sequence.Arcadia_StringBuffer_isEmpty
Arcadia_BooleanValue
Arcadia_StringBuffer_isEmpty
(
Arcadia_Thread* thread,
Arcadia_StringBuffer* self
)
Parameters
Arcadia_Thread
object.Return value
Arcadia_BooleanValue_True
if this string buffer is empty. Arcadia_BooleanValue_False
otherwise.
Errors
self
is a null pointer.Arcadia_String
Arcadia_String
represents an Unicode string encoded as UTF-8-NO-BOM.
This type is allocated on the heap and values of this type are referenced by Arcadia_String
pointers.
A Arcadia_String
pointer can be safely cast into a Arcadia_ObjectReferenceValue
values.
An Arcadia_ObjectReferenceValue
pointing to a Arcadia_String
value can be safely cast into a Arcadia_String
pointer.
Arcadia_String derives fro Arcadia_Object and overrides the following methods:
- Arcadia_Object_equalTo
- Arcadia_Object_hash
- Arcadia_Object_notEqualTo
Arcadia_String_create_pn
Arcadia_String*
Arcadia_String_create_pn
(
Arcadia_Thread* thread,
Arcadia_ImmutableByteArray* immutableByteArray
)
Parameters
Arcadia_Thread
object.Arcadia_ImmutableByteArray
objectReturn value
A pointer to the Arcadia_String
object.
Errors
immutableByteArray
is a null pointer.Arcadia_String_create
Arcadia_String*
Arcadia_String_create
(
Arcadia_Thread* thread,
Arcadia_Value value
)
Create a string from a value.
The following values are accepted:
The specified value may contain a Arcadia_ByteBuffer
object.
In that case, the string is created from the Bytes of the Byte buffer object.
A Arcadia_Status_EncodingInvalid
is raised if the Byte sequence of that Arcada_ByteBuffer
object is not a UTF8 Byte sequence.
The specified value may contain a Arcadia_ImmutableByteArray
object.
In that case, the string is created from the Arcadia_ImmutableByteArray
object.
A Arcadia_Status_EncodingInvalid
is raised if the Byte sequence of that Arcada_ImmutableByteArray
object is not a UTF8 Byte sequence.
The specified value may contain a Arcadia_String
object.
In that case, the string is created from the Arcadia_String
object.
The specified value may contain a Arcadia_StringBuffer
object.
In that case, the string is created from the Arcadia_StringBuffer
object.
The specified value may contain a Arcadia_ImmutableUtf8String
object.
In that case, the string is created from the Arcadia_ImmutableUtf8String
object.
Parameters
Arcadia_Thread
object.
Return value
A pointer to the string.
Errors
Arcadia_ByteBuffer
, Arcadia_String
, Arcadia_StringBuffer
, or Arcadia_ImmutableByteArray
.
Arcadia_ByteBuffer
or Arcadia_ImmutableByteArray
.
However, the Byte sequence of that Arcadia_ByteBuffer
or Arcadia_ImmutableByteArray
object is not a UTF8 Byte sequence.
Arcadia_String_endsWith_pn
Arcadia_BooleanValue
Arcadia_String_endsWith_pn
(
Arcadia_Thread* thread,
Arcadia_String const* self,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread
object.n
Bytes.p
.Return value
Arcadia_BooleanValue_True
if the sequence of Bytes is a suffix of this string's sequence of Bytes.
Arcadia_BooleanValue_False
otherwise.
Arcadia_String_startsWith_pn
Arcadia_BooleanValue
Arcadia_String_startsWith_pn
(
Arcadia_Thread* thread,
Arcadia_String const* self,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread
object.n
Bytes.p
.Return value
Arcadia_BooleanValue_True
if the sequence of Bytes is a prefix of this string's sequence of Bytes.
Arcadia_BooleanValue_False
otherwise.
Arcadia_String_isEqualTo_pn
Arcadia_BooleanValue
Arcadia_String_isEqualTo_pn
(
Arcadia_Thread* thread,
Arcadia_String const* self,
void const* bytes,
Arcadia_SizeValue numberOfBytes
)
Parameters
Arcadia_Thread
object.n
Bytes.p
.Return value
Arcadia_BooleanValue_True
if the sequence of Bytes is this string's sequence of Bytes.
Arcadia_BooleanValue_False
otherwise.
Arcadia_String_getNumberOfBytes
Arcadia_SizeValue
Arcadia_String_getNumberOfBytes
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Parameters
Arcadia_Thread
object.Return value
The size, in Bytes, of this string.
Arcadia_String_getByteAt
Arcadia_Natural8Value
Arcadia_String_getByteAt
(
Arcadia_String const* self,
Arcadia_SizeValue index
)
Parameters
Arcadia_Thread
object.[0,n)
where n
is the size, in Bytes, of this string.Return value
The Byte value.
Arcadia_String_toBoolean
Arcadia_BooleanValue
Arcadia_String_toBoolean
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_BooleanValue
.
Parameters
Arcadia_Thread
object.Return value
The boolean value.
Errors
self
is a null pointer.true
and false
, both case sensitve.Arcadia_String_toInteger16
Arcadia_Integer16Value
Arcadia_String_toInteger16
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Integer16Value
.
Parameters
Arcadia_Thread
object.Return value
The integer value.
Errors
self
is a null pointer.Arcadia_Integer16Value
.Arcadia_String_toInteger32
Arcadia_Integer32Value
Arcadia_String_toInteger32
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Integer32Value
.
Parameters
Arcadia_Thread
object.Return value
The integer value.
Errors
self
is a null pointer.
Arcadia_Integer32Value
.
Arcadia_String_toInteger64
Arcadia_Integer64Value
Arcadia_String_toInteger64
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Integer64Value
.
Parameters
Arcadia_Thread
object.Return value
The integer value.
Errors
self
is a null pointer.
Arcadia_Integer64Value
.Arcadia_String_toInteger8
Arcadia_Integer8Value
Arcadia_String_toInteger8
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Integer8Value
.
Parameters
Arcadia_Thread
object.Return value
The integer value.
Errors
self
is a null pointer.
Arcadia_Integer8Value
.Arcadia_String_toNatural16
Arcadia_Natural16Value
Arcadia_Stringg_toNatural16
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Natural16Value
.
Parameters
Arcadia_Thread
object.Return value
The natural value.
Errors
self
is a null pointer.Arcadia_Natural16Value
.Arcadia_String_toNatural32
Arcadia_Natural32Value
Arcadia_String_toNatural32
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Natural32Value
.
Parameters
Arcadia_Thread
object.Return value
The natural value.
Errors
self
is a null pointer.Arcadia_Natural32Value
.Arcadia_String_toNatural64
Arcadia_Natural64Value
Arcadia_String_toNatural64
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Natural64Value
.
Parameters
Arcadia_Thread
object.Return value
The natural value.
Errors
self
is a null pointer.Arcadia_Natural64Value
.Arcadia_String_toNatural8
Arcadia_Natural8Value
Arcadia_String_toNatural8
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Natural8Value
.
Parameters
Arcadia_Thread
object.Return value
The natural value.
Errors
self
is a null pointer.Arcadia_Natural8Value
.Arcadia_String_toReal32
Arcadia_Real32Value
Arcadia_String_toReal32
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Real32Value
.
Parameters
Arcadia_Thread
object.Return value
The Arcadia_Real32Value
value.
Errors
self
is a null pointer.Arcadia_Real32Value
.Arcadia_String_toReal64
Arcadia_Real64Value
Arcadia_String_toReal64
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_Real64Value
.
Parameters
Arcadia_Thread
object.Return value
The Arcadia_Real64Value
value.
Errors
self
is a null pointer.Arcadia_Real64Value
.Arcadia_String_toVoid
Arcadia_VoidValue
Arcadia_String_toVoid
(
Arcadia_Thread* thread,
Arcadia_String const* self
)
Arcadia_VoidValue
.
Parameters
Arcadia_Thread
object.Return value
The void value.
Errors
self
is a null pointer.void
, case sensitve.