/* ***************************************************************************** * * $RCSfile: grammutil.h,v $ * $Date: 1999/05/18 18:35:55 $ * $Source: /home/richard/Xml/RCS/grammutil.h,v $ * $Revision: 1.23 $ * $Author: richard $ * ***************************************************************************** * * Copyright 1998, 1999 Brown University and Richard Goerwitz * ***************************************************************************** */ #ifndef GRAMMUTIL_H_INCLUDED #define GRAMMUTIL_H_INCLUDED #include "general.h" #include "fileutil.h" #include "parstree.h" /* element entries point to a complex structure */ extern xml_element *expand_element (xml_file *, my_wchar_t *); /* notation names, peref entries, etc. all just point to strings */ extern my_wchar_t *expand_notname (xml_file *, my_wchar_t *); #define WITH_WHITESPACE 1 #define WITHOUT_WHITESPACE 0 extern my_wchar_t *expand_peref (xml_file *, my_wchar_t *, int); extern my_wchar_t *expand_eref (xml_file *, my_wchar_t *); extern my_wchar_t *expand_ext_eref (xml_file *, my_wchar_t *); /* unparsed entity reference values point to a sysid and a notation */ extern xml_unparsed_entity *expand_uperef (xml_file *, my_wchar_t *); extern my_wchar_t *expand_uperef_as_sysid (xml_file *, my_wchar_t *); extern my_wchar_t *expand_uperef_as_notation_name (xml_file *, my_wchar_t *); /* returns an appropriate xml_attribute structure */ extern xml_attribute *expand_attribute (xml_file *, my_wchar_t *, my_wchar_t *); /* returns an xml_node struct (i.e., a pointer into the parse tree) */ extern name_val *expand_id (xml_file *, my_wchar_t *); /* add_element will have to be expanded later to include content models*/ extern xml_element *add_element (xml_file *, my_wchar_t *, enum content_types, void *); extern size_t add_attribute (xml_file *, my_wchar_t *, xml_attribute *); /* add name/value combo to appropriate table */ extern size_t add_notname (xml_file *, my_wchar_t *, my_wchar_t *); extern size_t add_peref (xml_file *, my_wchar_t *, my_wchar_t *); extern my_wchar_t *add_ext_peref (xml_file *, my_wchar_t *, xml_file *, int); extern size_t add_eref (xml_file *, my_wchar_t *, my_wchar_t *); extern my_wchar_t *add_ext_eref (xml_file *, my_wchar_t *, xml_file *, int); extern my_wchar_t *add_ext_eref_text (xml_file *, my_wchar_t *, my_wchar_t *); /* add name/notation+sysid combo to xf->notation_names table */ extern size_t add_uperef (xml_file *, my_wchar_t *, my_wchar_t *, my_wchar_t *); /* unlike the other "add" routines; see docs */ extern size_t add_idref (struct xml_file *, my_wchar_t *val, my_wchar_t *lines); extern size_t add_id (struct xml_file *, struct name_val *); /* for expanding all entities in a string */ #define MAP_CHAR_ENTITIES 1 #define MAP_GENERAL_ENTITIES 2 #define UNPARSED_ENTITIES_OK 4 #define MAP_PARAMETER_ENTITIES 8 #define PAD_PARAMETER_ENTITIES 16 #define MAP_AMP_AND_LT 32 #define ABORT_ON_FAILURE 64 #define NO_EXTERNAL_EREFS 128 #define UNRESOLVABLES_OKAY 256 #define FLAG_BYPASSED_AMPERSANDS 512 extern my_wchar_t *map_entities (xml_file *, my_wchar_t *, int map_what, size_t depth); /* check a given attribute/value combo for a given element against the decl */ #define INSERT_IDS 1 #define DONT_INSERT_IDS 0 extern int check_attribute (xml_file *, my_wchar_t *, name_val *, int); /* silly SGML-compatibility check */ extern int check_dup_enum_vals (xml_file *, xml_element *); /* check for undeclared elements in content models of all elements */ extern int check_content_models (xml_file *xf); #endif /* GRAMMUTIL_H_INCLUDED */