#define MAX_CHUNKS 256
#define PAGES_PER_CHUNK 16
-/* General: All information from the directory structure is stored in */
-/* five buffers that comprise the IR: cdat_buf, odat_buf, vdat_buf, ref_buf */
-/* and link_buf. Each buf corresponds to the data structure that it stores. */
-/* The storage techique for all bufs (except cdat) is the same. Each bufs member first */
-/* populates its struct and then allocates the space for the next member */
-/* and increments the buf index. This means that we have to allocate the */
-/* very first member of each buf at ir_init(), so that we don't segfault */
-/* as the first member attempts to access memory that its previous member */
-/* didn't allocate (because it doesnt exist). We access the buf members */
-/* through standard array indexing but conceal the tediousness of array */
-/* indexing with macros. E.g. without macros, acessing an elements name */
-/* member would look like (split up to not go over line char limit): */
-/* (*cdat_stackp)->set_list[(*cdat_stackp)->num_sets] */
-/* .ele_list[(*cdat_stackp)->set_list[(*cdat_stackp->num_sets)].num_ele].name */
-
-/* For cdats in cdat_buf, we allocate the memory for a cdat once a cdat
- is recognized in the grammar. Cdat_buf is different from the other bufs
- because cdats have a root cdat that all cdats are a subclass of. This root
- cdat can have a set_list like other cdats. */
-
-/* All bufs are of pointers to their respective structs. When a buf is full */
-/* (number of data structs pointers >= max number of data struct pointers), */
-/* we need to allocate a more pointers for that buf. Allocate these */
-/* pointers a page at a time (1024 = Page bytes (4096)/bytes per pointer(4)) */
-
-/* Sets: The set is similar to the ele, but it contains a list of its */
-/* elements. The set is populated at parse time AFTER the elements are */
-/* populated, due to the nature of bottom up parsing. */
+/* Sets: elements. The set is populated at parse time AFTER the
+ elements are populated, due to the nature of bottom up parsing. */
struct set {
char name[32];
};
/* Cdats: A cdat is a class data structure. Cdats serve as the central */
-/* data types of the IR. At output, the cdat_buf is iterated through and */
-/* each is written to the output file. For each cdat, sets and element */
+/* data types of the IR. For each cdat, sets and element */
/* ref_ids must be dereferenced to determine the odat information. Cdats */
/* contain pointers to their subclasses so that the relationship between */
/* classes can be determined, but the subclasses are not represented inside */
-/* of the cdat itself but rather in the subsequent cdats in cdat_buf. We */
+/* of the cdat itself but rather in subsequent cdats in cdat_buf. We */
/* can determine the number of subclasses (the last index into cdat_buf */
/* that represents a subclass of some arbitrary cdat) each cdat has by */
/* incrementing num_classes during parse time. */
struct set set_list[MAX_SETS];
};
-/* There are an unknown amount of cdats at compile time, so we maintain */
-/* a cdat_buf of cdat pointers that can be expanded as needed. */
-
/* The cdat_stack is a stack pointers to cdat pointers, the top of which is
the cdat that is currently being parsed. Whenever a new cdat is recognized
by the grammar (CLOPEN), a cdat is pushed onto the cdat_stack, and we refer
};
-/* Like the cdat_buf, ref_buf stores pointers to refs and can
- increase in size */
-
-/* posts for ref_buf */
-
/* 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
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*/
+/* Svlinks stand for short vlink, which is a link to a vdat. svlinks
+ differ from vlinks because they do not have a name */
struct svlink {
uint64_t ref_id;
};
-/* A vlink is what it sounds like, a link to a vdat
- TODO: model link? */
+/* A vlink is what it sounds like, a link to a vdat */
struct vlink {
uint64_t ref_id;
char anim_name[32];
struct svlink svlink;
};
+/* From: Some odat ()To: Another odat (ref_id)*/
struct link {
int type; //1 = olink, 2 = vlink, 3 = svlink
union link_t link_t;
- int cdat_idx;
+ struct cdat* classp;
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 */
-
/* Odats: Odats consist of the object data necessary for
each object. Odats are sometimes referred to as archetypes
TODO: Need more info about objects at runtime, to described
the reasoning behind odat structure at compile-time*/
-
struct root {
int x, y, z;
};
struct odat {
char name[32];
- int vdat_id;
+ struct vdat* vdatp;
+ int vdat_id; //
int cdat_idx;
int hitbox;
uint64_t ref_id;