moved
[henge/webcc.git] / .org / data / fb / 24c302-4743-4a45-845a-4249d2b1a378 / ir.h
diff --git a/.org/data/fb/24c302-4743-4a45-845a-4249d2b1a378/ir.h b/.org/data/fb/24c302-4743-4a45-845a-4249d2b1a378/ir.h
deleted file mode 100755 (executable)
index 3b1d75c..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
-/*!@file\r
-  \brief   Intermediate Representation (IR) between Directory Structure and Engine Grammar\r
-  \details The IR serves as a storage structure that is populated during the\r
-           parsing of the input directory structure. After parsing is complete,\r
-           the IR will be condensed (removed of excess allocated space) and then\r
-           output as the Engine Grammar. In this file we describe the semantic actions\r
-           that are called at each step, and the memory buffers that they populate.\r
-           See parser.y for the description on how the input grammar is constructed,\r
-           and where/when semantic actions are called.\r
-           TODO: or just write it here.\r
-  \author  Jordan Lavatai\r
-  \date    Aug 2016\r
-  ----------------------------------------------------------------------------*/\r
-\r
-\r
-#include <stdint.h>\r
-\r
-#define BUF_SIZE 256\r
-#define MAX_SETS 256\r
-#define MAX_ELES 256\r
-#define MAX_QUADS 256\r
-#define MAX_MODELS 256\r
-#define MAX_POSTS 256\r
-#define MAX_CLASS_DEPTH 256\r
-#define MAX_CLASSES 256\r
-#define MAX_FRAMES 256\r
-#define PTRS_IN_PAGE 1024\r
-#define MAX_CHUNKS 256\r
-#define PAGES_PER_CHUNK 16\r
-\r
-/*  Sets: elements. The set is populated at parse time AFTER the\r
-    elements are populated, due to the nature of bottom up parsing.          */\r
-\r
-struct set {\r
-  char name[32];\r
-  uint64_t ref_id;\r
-  int cdat_idx;\r
-};\r
-\r
-/*  Cdats: A cdat is a class data structure. Cdats serve as the central       */\r
-/*  data types of the IR. For each cdat, sets and element                     */\r
-/*  ref_ids must be dereferenced to determine the odat information. Cdats     */\r
-/*  contain pointers to their subclasses so that the relationship between     */\r
-/*  classes can be determined, but the subclasses are not represented inside  */\r
-/*  of the cdat itself but rather in subsequent cdats in cdat_buf. We     */\r
-/*  can determine the number of subclasses (the last index into cdat_buf      */\r
-/*  that represents a subclass of some arbitrary cdat) each cdat has by       */\r
-/*  incrementing num_classes during parse time.                               */\r
-/*  TODO: Should classes point to their parent class?                         */\r
-\r
-struct cdat {\r
-  char name[32];\r
-  int idx;\r
-  int num_classes;\r
-  int num_sets;\r
-  struct cdat* class_list[MAX_CLASSES];\r
-  struct set set_list[MAX_SETS];\r
-};\r
-\r
-/* The cdat_stack is a stack pointers to cdat pointers, the top of which is\r
-   the cdat that is currently being parsed. Whenever a new cdat is recognized\r
-   by the grammar (CLOPEN), a cdat is pushed onto the cdat_stack, and we refer\r
-   to this cdat through the macro CURR_CDAT. By keeping a cdat_stack, we have\r
-   access to the current cdat so that the elements and sets can populate themselves\r
-   in the cdat accordingly. */\r
-\r
-\r
-/* Refs: Each set/ele has a reference to its object data (odat) through a ref_id.\r
-   Ref_ids are unsigned 64 byte integers that map to the hex values RGBA. During\r
-   the construction of the directory structure, users can choose a RGBA value for\r
-   each object that any other object can refer to via links (see link). If a user\r
-   does not choose an RGBA value, then the object is given one from the system space.\r
-   We maintain a doubly linked list of refs in the ref_buf at parse time so that\r
-   links can be resolved after the parsing of the directory structure is complete.\r
-   For every 16th ref, we create a post so that we can reduce on the search time for\r
-   a random access. */\r
-\r
-struct ref {\r
-  int type;\r
-  struct ref* nextref;\r
-  struct ref* lastref;\r
-  struct odat* odatp;\r
-  uint64_t ref_id; //0xFFFFFF->digit\r
-};\r
-\r
-\r
-/* Links: At parse time, a set/ele can include a link in their\r
-   grammar representation instead of the actual data and this signifies\r
-   to the APC that that set/ele wishes to use the data of another\r
-   set/ele, either its video data (vdat) or object data (odat). The link\r
-   itself contains the type of link it is, the ref_id OR name, and\r
-   which set/ele created the link. During parse time, links can be made\r
-   to o/vdats that have yet to be parsed. In order to accomodate for this,\r
-   we resolve all links AFTER parse time by iterating through the link_buf,\r
-   finding the ref_id that was stored for some object (if the ref_id exists),\r
-   and creating a relative pointer from the original object to the data that\r
-   was linked */\r
-\r
-/* Svlinks stand for short vlink, which is a link to a vdat. svlinks\r
-   differ from vlinks because they do not have a name */\r
-\r
-struct svlink {\r
-  uint64_t ref_id;\r
-};\r
-\r
-/* A vlink is what it sounds like, a link to a vdat */\r
-struct vlink {\r
-  uint64_t ref_id;\r
-  char anim_name[32];\r
-};\r
-\r
-union link_t {\r
-  struct vlink vlink;\r
-  struct svlink svlink;\r
-};\r
-\r
-/* From: src odat ()To: dest odat (ref_id)*/\r
-struct link {\r
-  int type; //1 = olink, 2 = vlink, 3 = svlink\r
-  union link_t link_t;\r
-  struct cdat* classp;\r
-  struct odat* odatp;\r
-  int set_idx;\r
-  int ele_idx;\r
-};\r
-\r
-\r
-/* Odats: Odats consist of the object data necessary for\r
-   each object. Odats are sometimes referred to as archetypes\r
-   at compile-time, in order to distinguish the difference from\r
-   a runtime object and a compile-time object.\r
-   TODO: Need more info about objects at runtime, to described\r
-         the reasoning behind odat structure at compile-time*/\r
-\r
-struct root {\r
-  int x, y, z;\r
-};\r
-\r
-struct odat {\r
-  char name[32];\r
-  struct vdat* vdatp;\r
-  int vdat_id; //\r
-  int cdat_idx;\r
-  int hitbox;\r
-  uint64_t ref_id;\r
-  struct root root;\r
-  struct ref* refp; /* pointer to it's ref on ref_list */\r
-  void* quad_filep;\r
-};\r
-\r
-struct odat* curr_set_odatp; //when a set has elements, insert_set() can no longer\r
-                            //refer to its odat via curr_odat, so save the set odat. \r
-\r
-/* A framesheet is a grouping of animation frames in\r
-   a single direction (N,W,S,E) */\r
-struct framesheet {\r
-  int width;\r
-  int height;\r
-  int num_frames;\r
-  void* frames[MAX_FRAMES];\r
-};\r
-\r
-/* A model is a collection of framesheets for every\r
-   direction (N,W,S,E,NW,NE,SW,SE)*/\r
-/* NAMED spritesheet */\r
-struct model {\r
-  char name[32];\r
-  struct framesheet spritesheet[8]; //one for each\r
-};\r
-\r
-/* Vdat: Vdats are the video data of each object. They can not be\r
-   created as a stand alone object (because they consist solely\r
-   of animation information and not the skeleton on which the\r
-   animation manipulates). Vdats have a list of models for every\r
-   animation that the vdats odat can do for that vdat*/\r
-struct vdat {\r
-  struct odat* creator; //pointer to odat that made this vdat\r
-  int num_models;\r
-  struct model model_list[MAX_MODELS];\r
-};\r
-\r
-/* Called after the cdat open operator has been recognized in grammar. Allocates\r
-   the space for a cdat on the cdat_buf, pushes that pointer onto\r
-   the cdat_stack */\r
-void\r
-push_cdat(char*);\r
-\r
-/* Called after a cdat end operator has been recognized in grammar. Sets\r
-   top stack cdat ** to null and decrements stack pointer */\r
-void\r
-pop_cdat(void);\r
-\r
-/* Called after an odat has been populated. Allocates memory for\r
-   the next odat. */\r
-\r
-void\r
-insert_set_label(char*, uint64_t);\r
-\r
-/* Populate the sets representation in CURR_CDAT with a ref_id and insert a link\r
-   into the link_buf that will resolve the ref_id to an actual odat after parse time. */\r
-void\r
-insert_set_olink(uint64_t);\r
-\r
-/* Put the vlink in the link_buf to be processed after parsetime */\r
-void\r
-insert_set_vlink(uint64_t, char*);\r
-\r
-/* Put svlink in the link_buf to be processed after parsetime */\r
-void\r
-insert_set_svlink(uint64_t);\r
-\r
-/* Called for every set reduction except for sets with olinks. Populates the\r
-   set data structures in the CDAT and in the ODAT. Uses the name and ref_id\r
-   from insert_set_label. Also inserts a ref into the ref_buf with the CURR_ODAT\r
-   pointer so that we can also resolve the odat from its ref_id. */\r
-void\r
-insert_set(void);\r
-\r
-/* Insertion of eles is practically equivalent to how sets are inserted because both\r
-   share the same data type (ODAT). Like sets, eles have links, labels\r
-   and odats. Eles have the added notion of a parent set, and so must be inserted\r
-   into said parent set, but this is the only place they truly differ from sets. */\r
-\r
-void\r
-insert_set_vdatid(void);\r
-\r
-void\r
-insert_ele_label(char*, uint64_t);\r
-\r
-/* Insert an ele olink into the CURR_ODAT */\r
-void\r
-insert_ele_olink(uint64_t);\r
-\r
-/* Insert a ele vlink  into CURR_ODAT*/\r
-void\r
-insert_ele_vlink(uint64_t, char*);\r
-\r
-/* Inserts an ele short vlink into CURR_ODAT*/\r
-void\r
-insert_ele_svlink(uint64_t);\r
-\r
-/* inserts ele into CURR_CLASS and CURR_ODAT */\r
-void\r
-insert_ele(void);\r
-\r
-void\r
-insert_ele_vdatid(void);\r
-\r
-/* Inserts the hitbox into the CURR_ODAT */\r
-void\r
-insert_hitbox(int);\r
-\r
-/* Inserts the root into the CURR_ODAT */\r
-void\r
-insert_root(int, int, int);\r
-\r
-/* Inserts a quad into the CURR_ODAT */\r
-void\r
-insert_quad(void*);\r
-\r
-void\r
-insert_model(void);\r
-\r
-void\r
-insert_framesheet(char, char*, uint64_t, int, int, int);\r
-\r
-void\r
-insert_frame_pointer(char, void*);\r
-\r
-void\r
-alloc_vdat(void);\r