// runic_obj_t

The other critical element of file manipulation is handled through the runic_obj_t artifact. The file contains many runic_obj_t derivatives in memory, and they are broken down into two major categories: NODE and ATOM. As previously mentioned in the runic_t section, intelligent use of the two object types allow manipulation and creation of abstract syntax trees. Each object (NODE and ATOM) contains a tag. This tag is either assigned 0 (as defined by NODE_TAG_VALUE) or a positive integer equal to the size in bytes of the respective ATOM string.

// node

Beyond the tag, each NODE contains two data elements (a left and right child) which will be used to reference other NODE or ATOM. The overall size of a node is 17 bytes.

The following operations can be performed on a NODE:

// accessors
runic_obj_ty_t runic_obj_ty(runic_obj_t ro);
runic_obj_t runic_node_left(runic_obj_t ro);
runic_obj_t runic_node_right(runic_obj_t ro);

// mutators
bool runic_node_set_left(runic_obj_t* parent, runic_obj_t child);
bool runic_node_set_right(runic_obj_t* parent, runic_obj_t child);

// atom

As mentioned, an ATOM contains the size of value (an ascii string) in bytes in the tag field, as well as the value itself. The overall size of an ATOM is therefore variable length, equal to the ascii string + 1(the tag).

The following operations can be performed on an ATOM:

// accessors
runic_obj_ty_t runic_obj_ty(runic_obj_t ro);
size_t runic_atom_size(runic_obj_t ro);
bool runic_atom_read(runic_obj_t ro, char* c);

// mutators
bool runic_atom_write(runic_obj_t* ro, const char* val);