diff options
Diffstat (limited to 'WWW/Library/Implementation/SGML.h')
-rw-r--r-- | WWW/Library/Implementation/SGML.h | 147 |
1 files changed, 76 insertions, 71 deletions
diff --git a/WWW/Library/Implementation/SGML.h b/WWW/Library/Implementation/SGML.h index 2c75b088..c595dc91 100644 --- a/WWW/Library/Implementation/SGML.h +++ b/WWW/Library/Implementation/SGML.h @@ -21,39 +21,41 @@ #include <HTAnchor.h> #include <LYJustify.h> +#ifdef __cplusplus +extern "C" { +#endif /* SGML content types - */ -typedef enum { - SGML_EMPTY, /* No content. */ - SGML_LITTERAL, /* Literal character data. Recognize exact close tag only. + */ typedef enum { + SGML_EMPTY, /* No content. */ + SGML_LITTERAL, /* Literal character data. Recognize exact close tag only. Old www server compatibility only! Not SGML */ - SGML_CDATA, /* Character data. Recognize </ only. + SGML_CDATA, /* Character data. Recognize </ only. (But we treat it just as SGML_LITTERAL.) */ - SGML_SCRIPT, /* Like CDATA, but allow it to be a comment */ - SGML_RCDATA, /* Replaceable character data. Should recognize </ and &ref; + SGML_SCRIPT, /* Like CDATA, but allow it to be a comment */ + SGML_RCDATA, /* Replaceable character data. Should recognize </ and &ref; (but we treat it like SGML_MIXED for old times' sake). */ - SGML_MIXED, /* Elements and parsed character data. + SGML_MIXED, /* Elements and parsed character data. Recognize all markup. */ - SGML_ELEMENT, /* Any data found should be regarded as an error. + SGML_ELEMENT, /* Any data found should be regarded as an error. (But we treat it just like SGML_MIXED.) */ - SGML_PCDATA /* Should contain no elements but &ref; is parsed. + SGML_PCDATA /* Should contain no elements but &ref; is parsed. (We treat it like SGML_CDATA wrt. contained tags i.e. pass them on literally, i.e. like we should treat SGML_RCDATA) (added by KW). */ -} SGMLContent; + } SGMLContent; -typedef struct { - const char *name; /* The name of the attribute */ + typedef struct { + const char *name; /* The name of the attribute */ #ifdef USE_PRETTYSRC - char type; /* code of the type of the attribute. Code + char type; /* code of the type of the attribute. Code values are in HTMLDTD.h */ #endif -} attr; + } attr; -typedef int TagClass; + typedef int TagClass; /* textflow */ #define Tgc_FONTlike 0x00001 /* S,STRIKE,I,B,TT,U,BIG,SMALL,STYLE,BLINK;BR,TAB */ @@ -91,7 +93,7 @@ typedef int TagClass; /* Some more properties of tags (or rather, elements) and rules how to deal with them. - kw */ -typedef int TagFlags; + typedef int TagFlags; #define Tgf_endO 0x00001 /* end tag can be Omitted */ #define Tgf_startO 0x00002 /* start tag can be Omitted */ @@ -124,46 +126,46 @@ typedef int TagFlags; * except for that which opens a matching closing tag. * */ -typedef struct _tag HTTag; -struct _tag { - const char *name; /* The name of the tag */ + typedef struct _tag HTTag; + struct _tag { + const char *name; /* The name of the tag */ #ifdef USE_COLOR_STYLE - int name_len; /* The length of the name */ + int name_len; /* The length of the name */ #endif #ifdef EXP_JUSTIFY_ELTS - BOOL can_justify; /* justification allowed? */ + BOOL can_justify; /* justification allowed? */ #endif - attr *attributes; /* The list of acceptable attributes */ - int number_of_attributes; /* Number of possible attributes */ - SGMLContent contents; /* End only on end tag @@ */ - TagClass tagclass; - TagClass contains; /* which classes of elements this one can contain directly */ - TagClass icontains; /* which classes of elements this one can contain indirectly */ - TagClass contained; /* in which classes can this tag be contained ? */ - TagClass icontained; /* in which classes can this tag be indirectly contained ? */ - TagClass canclose; /* which classes of elements can this one close + attr *attributes; /* The list of acceptable attributes */ + int number_of_attributes; /* Number of possible attributes */ + SGMLContent contents; /* End only on end tag @@ */ + TagClass tagclass; + TagClass contains; /* which classes of elements this one can contain directly */ + TagClass icontains; /* which classes of elements this one can contain indirectly */ + TagClass contained; /* in which classes can this tag be contained ? */ + TagClass icontained; /* in which classes can this tag be indirectly contained ? */ + TagClass canclose; /* which classes of elements can this one close if something looks wrong ? */ - TagFlags flags; -}; + TagFlags flags; + }; /* DTD Information * --------------- * * Not the whole DTD, but all this parser uses of it. */ -typedef struct { - HTTag *tags; /* Must be in strcmp order by name */ - int number_of_tags; - const char **entity_names; /* Must be in strcmp order by name */ - size_t number_of_entities; - /* "entity_names" table probably unused, - * see comments in HTMLDTD.c near the top - */ -} SGML_dtd; + typedef struct { + HTTag *tags; /* Must be in strcmp order by name */ + int number_of_tags; + const char **entity_names; /* Must be in strcmp order by name */ + size_t number_of_entities; + /* "entity_names" table probably unused, + * see comments in HTMLDTD.c near the top + */ + } SGML_dtd; /* SGML context passed to parsers */ -typedef struct _HTSGMLContext *HTSGMLContext; /* Hidden */ + typedef struct _HTSGMLContext *HTSGMLContext; /* Hidden */ /*__________________________________________________________________________ */ @@ -187,44 +189,44 @@ Structured Object definition Maybe the callerData is enough info to pass along. */ -typedef struct _HTStructured HTStructured; + typedef struct _HTStructured HTStructured; -typedef struct _HTStructuredClass { + typedef struct _HTStructuredClass { - const char *name; /* Just for diagnostics */ + const char *name; /* Just for diagnostics */ - void (*_free) (HTStructured * me); + void (*_free) (HTStructured * me); - void (*_abort) (HTStructured * me, HTError e); + void (*_abort) (HTStructured * me, HTError e); - void (*put_character) (HTStructured * me, char ch); + void (*put_character) (HTStructured * me, char ch); - void (*put_string) (HTStructured * me, const char *str); + void (*put_string) (HTStructured * me, const char *str); - void (*_write) (HTStructured * me, const char *str, - int len); + void (*_write) (HTStructured * me, const char *str, + int len); - int (*start_element) (HTStructured * me, int element_number, - const BOOL *attribute_present, - const char **attribute_value, - int charset, - char **include); + int (*start_element) (HTStructured * me, int element_number, + const BOOL *attribute_present, + const char **attribute_value, + int charset, + char **include); - int (*end_element) (HTStructured * me, int element_number, - char **include); + int (*end_element) (HTStructured * me, int element_number, + char **include); - int (*put_entity) (HTStructured * me, int entity_number); + int (*put_entity) (HTStructured * me, int entity_number); -} HTStructuredClass; + } HTStructuredClass; /* Equivalents to the following functions possibly could be generalised into additional HTStructuredClass members. For now they don't do anything target-specific. - kw */ -extern BOOLEAN LYCheckForCSI(HTParentAnchor *anchor, char **url); -extern void LYDoCSI(char *url, const char *comment, char **csi); -extern BOOLEAN LYCommentHacks(HTParentAnchor *anchor, const char *comment); + extern BOOLEAN LYCheckForCSI(HTParentAnchor *anchor, char **url); + extern void LYDoCSI(char *url, const char *comment, char **csi); + extern BOOLEAN LYCommentHacks(HTParentAnchor *anchor, const char *comment); /* @@ -233,8 +235,8 @@ Find a Tag by Name Returns a pointer to the tag within the DTD. */ -extern HTTag *SGMLFindTag(const SGML_dtd * dtd, - const char *string); + extern HTTag *SGMLFindTag(const SGML_dtd * dtd, + const char *string); /* @@ -249,10 +251,13 @@ Create an SGML parser * On exit, * The default tag starter has been processed. */ -extern HTStream *SGML_new(const SGML_dtd * dtd, - HTParentAnchor *anchor, - HTStructured * target); + extern HTStream *SGML_new(const SGML_dtd * dtd, + HTParentAnchor *anchor, + HTStructured * target); -extern const HTStreamClass SGMLParser; + extern const HTStreamClass SGMLParser; -#endif /* SGML_H */ +#ifdef __cplusplus +} +#endif +#endif /* SGML_H */ |