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. Arcadia Ring 2 is available at michaelheilmann.com/Arcadia/Ring2.
Features:
- UTF-8 strings and string buffers, decoders and encoders
- 32 and 64 Bit IEEE 754 floating point <=> UTF-8 string conversions based on the works of Steele & White, Gay, Clinger, Lemire & Musthak.
- Other scalar types (Void, Boolean, Integer, Natural) <=> UTF-8 string conversions
- aggregates (array lists, array deques, hash maps)
- File System implementation for Windows and Linux supporting creation and deletation of files, reading and writing files, enumerating contents of folder
Files
You can find the sources of Arcadia Ring 2 in my GitHub repository https://github.com/michaelheilmann/arcadia. The subdirectory of Arcadia Ring 2 in the repository is here https://github.com/michaelheilmann/arcadia/tree/main/Runtime/Ring2.
- The (sources of the) library resides in the directory https://github.com/michaelheilmann/arcadia/tree/main/Runtime/Ring2/Library
- The (sources of) tests reside in the directory https://github.com/michaelheilmann/arcadia/tree/main/Runtime/Ring2/Tests
- The (sources of this very documentation you are reading) documentation reside in the directory https://github.com/michaelheilmann/arcadia/tree/main/Runtime/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.
String extensions
The functions in this section extend Arcadia_String, Arcadia_StringBuilder, and Arcadia_ByteArrayBuilder with conversions to and from C++ (C) values and null-terminated C-strings.
Arcadia_String_createFromCxxInt
Arcadia_String*
Arcadia_String_createFromCxxInt
(
Arcadia_Thread* thread,
int x
)
Parameters
Arcadia_Thread object.Return value
A pointer to the Arcadia_String object.
Errors
Arcadia_String_toCxxInt
int
Arcadia_String_toCxxInt
(
Arcadia_Thread* thread,
Arcadia_String* self
)
Parameters
Arcadia_Thread object.Return value
The C++ int value of this string.
Errors
Arcadia_String_createFromCxxString
Arcadia_String*
Arcadia_String_createFromCxxString
(
Arcadia_Thread* thread,
const char *x
)
Parameters
Arcadia_Thread object.Return value
A pointer to the Arcadia_String object.
Errors
x is a null pointer.Arcadia_StringBuilder_insertBackCxxInt
void
Arcadia_StringBuilder_insertBackCxxInt
(
Arcadia_Thread* thread,
Arcadia_StringBuilder* self,
int x
)
Parameters
Arcadia_Thread object.Errors
self is a null pointer.Arcadia_StringBuilder_insertBackCxxString
void
Arcadia_StringBuilder_insertBackCxxString
(
Arcadia_Thread* thread,
Arcadia_StringBuilder* self,
const char *x
)
Parameters
Arcadia_Thread object.Errors
self or x is a null pointer.Arcadia_StringBuilder_insertFrontString
void
Arcadia_StringBuilder_insertFrontString
(
Arcadia_Thread* thread,
Arcadia_StringBuilder* self,
Arcadia_String* x
)
Parameters
Arcadia_Thread object.Errors
self or x is a null pointer.Arcadia_StringBuilder_insertBackString
void
Arcadia_StringBuilder_insertBackString
(
Arcadia_Thread* thread,
Arcadia_StringBuilder* self,
Arcadia_String* x
)
Parameters
Arcadia_Thread object.Errors
self or x is a null pointer.Arcadia_String_insertByteBuffer
void
Arcadia_String_insertByteBuffer
(
Arcadia_Thread* thread,
Arcadia_String* self,
Arcadia_SizeValue index,
Arcadia_ByteArrayBuilder* target
)
Parameters
Arcadia_Thread object.[0,n) where n is the size, in Bytes, of the Byte buffer.Errors
self or target is a null pointer, or index is outside the bounds of the Byte buffer.Arcadia_String_insertFrontByteBuffer
void
Arcadia_String_insertFrontByteBuffer
(
Arcadia_Thread* thread,
Arcadia_String* self,
Arcadia_ByteArrayBuilder* target
)
Parameters
Arcadia_Thread object.Errors
self or target is a null pointer.Arcadia_String_insertBackByteBuffer
void
Arcadia_String_insertBackByteBuffer
(
Arcadia_Thread* thread,
Arcadia_String* self,
Arcadia_ByteArrayBuilder* target
)
Parameters
Arcadia_Thread object.Errors
self or target is a null pointer.Time
This section documents the time API of Arcadia Ring 2.
A point in time is represented by a timestamp - an Arcadia_Integer64Value - and by an Arcadia_PointInTime object which provides access to the date and time fields of the represented moment.
The date and time fields can be interpreted in either universal time coordinated (UTC) or local time, as determined by an Arcadia_TimeSpecification value.
Arcadia_TimeSpecification
typedef implementation detail Arcadia_TimeSpecification
Arcadia_TimeSpecification type is an enumeration type determining the time specification in which the date and time fields of a point in time are represented.
Arcadia_TimeSpecification_Utc
#define Arcadia_TimeSpecification_Utc implementation detail
Arcadia_TimeSpecification_Utc value denotes time in the Universal Time Coordinated (UTC) time specification.
Arcadia_TimeSpecification_LocalTime
#define Arcadia_TimeSpecification_LocalTime implementation detail
Arcadia_TimeSpecification_LocalTime value denotes time in the local time specification.
Arcadia_PointInTime
Arcadia_PointInTime extends Arcadia_Object.
Arcadia_PointInTime represents a point in time. The point in time is given by a timestamp, the number of seconds since the start of the epoch.
Arcadia_TimeStamp_getNow
Arcadia_Integer64Value
Arcadia_TimeStamp_getNow
(
Arcadia_Thread* thread
)
Parameters
Arcadia_Thread object.Return value
The timestamp of now.
Arcadia_PointInTime_create
Arcadia_PointInTime*
Arcadia_PointInTime_create
(
Arcadia_Thread* thread,
Arcadia_Integer64Value timeStamp
)
Parameters
Arcadia_Thread object.Return value
A pointer to the Arcadia_PointInTime object.
Errors
Arcadia_PointInTime_getDayOfWeek
Arcadia_Integer8Value
Arcadia_PointInTime_getDayOfWeek
(
Arcadia_Thread* thread,
Arcadia_PointInTime* self,
Arcadia_TimeSpecification timeSpecification
)
Parameters
Arcadia_Thread object.Return value
The day of the week, in the range [0,6]. 0 denotes Sunday, 6 denotes Saturday.
Errors
timeSpecification is not a value of the Arcadia_TimeSpecification type.Arcadia_PointInTime_getDayOfMonth
Arcadia_Integer8Value
Arcadia_PointInTime_getDayOfMonth
(
Arcadia_Thread* thread,
Arcadia_PointInTime* self,
Arcadia_TimeSpecification timeSpecification
)
Parameters
Arcadia_Thread object.Return value
The day of the month, in the range [0,30]. The day is zero based, 0 denotes the first day of the month.
Errors
timeSpecification is not a value of the Arcadia_TimeSpecification type.Arcadia_PointInTime_getMonth
Arcadia_Integer8Value
Arcadia_PointInTime_getMonth
(
Arcadia_Thread* thread,
Arcadia_PointInTime* self,
Arcadia_TimeSpecification timeSpecification
)
Parameters
Arcadia_Thread object.Return value
The month of the year, in the range [0,11]. The month is zero based, 0 denotes January, 11 denotes December.
Errors
timeSpecification is not a value of the Arcadia_TimeSpecification type.Arcadia_PointInTime_getYear
Arcadia_Integer32Value
Arcadia_PointInTime_getYear
(
Arcadia_Thread* thread,
Arcadia_PointInTime* self,
Arcadia_TimeSpecification timeSpecification
)
Parameters
Arcadia_Thread object.Return value
The year. The returned value is the number of years since 1900; adding 1900 to the returned value yields the calendar year.
Errors
timeSpecification is not a value of the Arcadia_TimeSpecification type.