/*!@file \brief Intermediate Representation (IR) between Directory Structure and Engine Grammar \details The IR serves as a storage structure that is populated during the parsing of the input directory structure. After parsing is complete, the IR will be condensed (removed of excess allocated space) and then output as the Engine Grammar. In this file we describe the semantic actions that are called at each step, and the memory buffers that they populate. See parser.y for the description on how the input grammar is constructed, and where/when semantic actions are called. TODO: or just write it here. \author Jordan Lavatai \date Aug 2016 ----------------------------------------------------------------------------*/ #include #define BUF_SIZE 256 #define MAX_SETS 256 #define MAX_ELES 256 #define MAX_QUADS 256 #define MAX_MODELS 256 #define MAX_POSTS 256 #define MAX_CLASS_DEPTH 256 #define MAX_CLASSES 256 #define MAX_FRAMES 256 #define PTRS_IN_PAGE 1024 /* Called after the cdat open operator has been recognized in grammar. Allocates the space for a cdat on the cdat_buf, pushes that pointer onto the cdat_stack */ void push_cdat(char*); /* Called after a cdat end operator has been recognized in grammar. Sets top stack cdat ** to null and decrements stack pointer */ void pop_cdat(void); /* Called after an odat has been populated. Allocates memory for the next odat. */ void insert_set_label(char*, uint64_t); /* Populate the sets representation in CURR_CDAT with a ref_id and insert a link into the link_buf that will resolve the ref_id to an actual odat after parse time. */ void insert_set_olink(uint64_t); /* Put the vlink in the link_buf to be processed after parsetime */ void insert_set_vlink(uint64_t, char*); /* Put svlink in the link_buf to be processed after parsetime */ void insert_set_svlink(uint64_t); /* Called for every set reduction except for sets with olinks. Populates the set data structures in the CDAT and in the ODAT. Uses the name and ref_id from insert_set_label. Also inserts a ref into the ref_buf with the CURR_ODAT pointer so that we can also resolve the odat from its ref_id. */ void insert_set(void); /* Insertion of eles is practically equivalent to how sets are inserted because both share the same data type (ODAT). Like sets, eles have links, labels and odats. Eles have the added notion of a parent set, and so must be inserted into said parent set, but this is the only place they truly differ from sets. */ void insert_ele_label(char*, uint64_t); /* Insert an ele olink into the CURR_ODAT */ void insert_ele_olink(uint64_t); /* Insert a ele vlink into CURR_ODAT*/ void insert_ele_vlink(uint64_t, char*); /* Inserts an ele short vlink into CURR_ODAT*/ void insert_ele_svlink(uint64_t); /* inserts ele into CURR_CLASS and CURR_ODAT */ void insert_ele(void); void insert_vdat(void); /* Inserts the hitbox into the CURR_ODAT */ void insert_hitbox(int); /* Inserts the root into the CURR_ODAT */ void insert_root(int, int, int); /* Inserts a quad into the CURR_ODAT */ void insert_quad(int, int, int, uint64_t); void insert_model(void); void insert_framesheet(char, char*, uint64_t, int, int, int); void insert_frame_pointer(char, void*);