/*!@file \brief Intermediate Representation (IR) between Directory Structure and Engine Input \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 input for the engine. 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. All input values are duplicated internally and their memory may be freed. \author Jordan Lavatai \date Aug 2016 ----------------------------------------------------------------------------*/ #ifndef _IR_H_ #define _IR_H_ #include #include "apc.h" typedef union ir_setdata_t* ir_setdata; typedef struct ir_set_t* ir_set; typedef struct ir_class_t* ir_class; typedef struct ir_setld_t* ir_setld; typedef struct ir_classld_t* ir_classld; /* Classes and Sets Classes are rooted at a special root class, representing the current working directory at scan-time, named ".". The root class can always be identified with ir_class_root, and children may be added to it. The add series of functions will return a reference to the newly created object, which may also be used the root for further add functions. E.G. ir_class x = ir_class_root(); x = ir_class_addchild(x, "mychild"); x = ir_class_addchild(x, "child of mychild"); Sets, like classes, must be rooted. Unlike classes, sets may be rooted on other sets, in addition to classes. ir_class_addset will return a set rooted on the class specified, while ir_set_addchild will return a set rooted on the specified set. */ ir_class ir_class_root(void); ir_class ir_class_addchild(ir_class, uint8_t*); ir_set ir_class_addset(ir_class,uint8_t*); ir_set ir_set_addchild(ir_set,uint8_t*); /* Set Data Each set can contain up to FACING_MAX each of framesheets and mapsheets, one sheet for each facing, per label. Each set can contain any number of audio objects, supplied by label. Repeat assignment of conflicting data (e.g. two SFACE framesheets assigned to the same set and label, or two audio objects with the same label) causes an internal error. Each set may also contain any number of link objects, which will be linked in the order that they are encountered. At link time, repeated assignments of conflicting data cause data to be silently overwritten for those sets. This is an intentional side-effect of the linker. Each setdata may have a path associated with it. If the data depends on the data of an associated file at that path and no path is provided, the data will be entered null. */ void ir_set_assign_data(ir_set,ir_setdata); void ir_set_assign_ref(ir_set,long long); void ir_data_assign_path(ir_setdata,uint8_t*); ir_setdata ir_framesheet(uint8_t*, apc_facing, int,int); ir_setdata ir_mapsheet(uint8_t*, apc_facing, int,int); ir_setdata ir_audio(uint8_t*); ir_setdata ir_link_odat(ir_setld); ir_setdata ir_link_vdat(ir_setld,uint8_t*); ir_setdata ir_link_mdat(ir_setld,uint8_t*); ir_setdata ir_link_adat(ir_setld,uint8_t*); /* Reference Linking Data Create linking data to sets or classes that will be resolved at a later stage. Class references can be created from an ir_class object, if available, or from the root class. Set references can be created from a 64-bit integer ID, or from a class linking data and a child name. Once created, both Class and Set link data can traverse children, specified by name, which will be resolved at the linking stage as well. */ ir_classld ir_classld_from_class(ir_class); ir_classld ir_classld_from_root(void); ir_classld ir_classld_addchild(ir_classld,uint8_t*); ir_setld ir_setld_from_ref(long long); ir_setld ir_setld_from_classld(ir_classld,uint8_t*); ir_setld ir_setld_addchild(ir_setld,uint8_t*); #endif //_IR_H_