/***************************************************************************/ /* >>>>>>>>>>>>>>>>>>>>>>>>>>>> GENIELIB.H <<<<<<<<<<<<<<<<<<<<<<<<<<< */ /*-------------------------------------------------------------------------*/ /* Prototypes for utility functions specific to Genie. */ /* */ /* Cathy Riemer / cathy@cse.psu.edu v2 */ /***************************************************************************/ /* $Id: genielib.h,v 1.12 1996/04/10 05:12:34 cathy Exp cathy $ */ #ifndef GENIELIB #define GENIELIB #include "genie.h" /* type_form, attribute, */ /* modifier, instance, tuplink */ #include "scanlib.h" /* YYLTYPE */ /* Function Prototypes */ type_form type_of /* get type for instance */ (instance *inst); int is_simple /* test for simple attribute */ (type_form type); int is_composite /* test for composite attribute */ (type_form type); int is_optional /* test for optional attribute */ (attribute *attr); int attrcount /* count simple attrs in schema */ (attribute *attr); attribute *new_attr /* create a "loose" attribute */ (type_form type); char *stringval /* get string version of value */ (instance *inst); int check_mod /* check value against modifiers */ (instance *inst, modifier *modlist, YYLTYPE loc); int find_key /* find key instance in tuple */ (tuplink *tup); instance *find_inst /* find instance in tuple */ (tuplink *tup, char *aname); instance *error_inst /* create an ERR_TYPE instance */ (void); int instcomp /* compare two instance values */ (instance *inst1, instance *inst2, char *precision); int tupcomp /* compare two tuples */ (tuplink *tup1, tuplink *tup2, char *precision); attribute *attrcopy /* make a copy of an attribute */ (attribute *original); varlink *varcopy /* make a copy of a variant */ (varlink *original, attribute *parent); modifier *modcopy /* make a copy of a modifier */ (modifier *original); instance *instcopy /* make a copy of an instance */ (instance *original); tuplink *tupcopy /* make a copy of a tuple */ (tuplink *original); void strip_attr /* free an attribute's members */ (attribute *attr); void free_var /* free a variant */ (varlink *var); void free_mod /* free a modifier */ (modifier *mod); void strip_inst /* free an instance's members */ (instance *inst); void free_tup /* free a tuple */ (tuplink *tup); void merge_schema /* merge two schemas (plus data) */ (attribute **schema1, attribute *schema2, instance **data1, instance *data2); instance *merge_data /* merge data for same schema */ (instance *data1, instance *data2); void genie_reset /* reset Genie; clear everything */ (void); /* Macro Definitions */ #define instsame !instcomp /* see if instances are the same */ #define tupsame !tupcomp /* see if two tuples are the same */ #endif