+/* Like the cdat_buf, ref_buf stores pointers to refs and can
+ increase in size */
+struct ref* ref_buf[PTRS_IN_PAGE];
+int num_refs = 0;
+int curr_max_refs = PTRS_IN_PAGE;
+uint64_t ss_ref_id = 0x00FFFFFF; /* system space for ref_ids */
+
+
+/* posts for ref_buf */
+struct ref posts[MAX_POSTS];
+int num_posts;
+
+/* Links: At parse time, a set/ele can include a link in their
+ grammar representation instead of the actual data and this signifies
+ to the APC that that set/ele wishes to use the data of another
+ set/ele, either its video data (vdat) or object data (odat). The link
+ itself contains the type of link it is, the ref_id OR name, and
+ which set/ele created the link. During parse time, links can be made
+ to o/vdats that have yet to be parsed. In order to accomodate for this,
+ we resolve all links AFTER parse time by iterating through the link_buf,
+ finding the ref_id that was stored for some object (if the ref_id exists),
+ and creating a relative pointer from the original object to the data that
+ was linked */
+
+/* Svlinks stand for short vlink, which is a link to a vdat
+ TODO: diff btwn vlink*/
+
+struct svlink {
+ uint64_t ref_id;
+};
+
+/* A vlink is what it sounds like, a link to a vdat
+ TODO: model link? */
+struct vlink {
+ uint64_t ref_id;
+ char anim_name[32];
+};
+
+/* Olinks are links to odats */
+struct olink {
+ uint64_t ref_id;
+};
+
+union link_t {
+ struct olink olink;
+ struct vlink vlink;
+ struct svlink svlink;
+};
+
+struct link {
+ int type; //1 = olink, 2 = vlink, 3 = svlink
+ union link_t link_t;
+ int cdat_idx;
+ int set_idx;
+ int ele_idx;
+};
+/* link_buf contains all the links that
+ we encountered during parse time that need
+ to be resolved to an offset at output time.
+ This does not include quad refs, because
+ those are already known to need to be resolved */
+struct link* link_buf[PTRS_IN_PAGE];
+int num_links = 0;
+int curr_max_links = PTRS_IN_PAGE;
+
+
+/* Odats: Odats consist of the object data necessary for
+ each object. Odats are sometimes referred to as archetypes
+ at compile-time, in order to distinguish the difference from
+ a runtime object and a compile-time object.
+ TODO: Need more info about objects at runtime, to described
+ the reasoning behind odat structure at compile-time*/
+
+/* Each set has a quad_list or a list of quads. The quad_list
+ is the ? */
+struct quad {
+ int x, y, z;
+ uint64_t ref_id; //rgba
+};
+
+struct root {
+ int x, y, z;