home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 15 / Amiga Plus Leser CD 15.iso / Tools / Development / MosaicSRC / libwww2 / HTMLDTD.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-03-13  |  6.1 KB  |  203 lines

  1. /*        Our Static DTD for HTML
  2. **        -----------------------
  3. */
  4.  
  5. /* Implements:
  6. */
  7.  
  8. #include "HTMLDTD.h"
  9.  
  10. /*     Entity Names
  11. **    ------------
  12. **
  13. **    This table must be matched exactly with ALL the translation tables
  14. */
  15. static CONST char* entities[] = {
  16.   "AElig",    /* capital AE diphthong (ligature) */ 
  17.   "Aacute",    /* capital A, acute accent */ 
  18.   "Acirc",    /* capital A, circumflex accent */ 
  19.   "Agrave",    /* capital A, grave accent */ 
  20.   "Aring",    /* capital A, ring */ 
  21.   "Atilde",    /* capital A, tilde */ 
  22.   "Auml",    /* capital A, dieresis or umlaut mark */ 
  23.   "Ccedil",    /* capital C, cedilla */ 
  24.   "ETH",    /* capital Eth, Icelandic */ 
  25.   "Eacute",    /* capital E, acute accent */ 
  26.   "Ecirc",    /* capital E, circumflex accent */ 
  27.   "Egrave",    /* capital E, grave accent */ 
  28.   "Euml",    /* capital E, dieresis or umlaut mark */ 
  29.   "Iacute",    /* capital I, acute accent */ 
  30.   "Icirc",    /* capital I, circumflex accent */ 
  31.   "Igrave",    /* capital I, grave accent */ 
  32.   "Iuml",    /* capital I, dieresis or umlaut mark */ 
  33.   "Ntilde",    /* capital N, tilde */ 
  34.   "Oacute",    /* capital O, acute accent */ 
  35.   "Ocirc",    /* capital O, circumflex accent */ 
  36.   "Ograve",    /* capital O, grave accent */ 
  37.   "Oslash",    /* capital O, slash */ 
  38.   "Otilde",    /* capital O, tilde */ 
  39.   "Ouml",    /* capital O, dieresis or umlaut mark */ 
  40.   "THORN",    /* capital THORN, Icelandic */ 
  41.   "Uacute",    /* capital U, acute accent */ 
  42.   "Ucirc",    /* capital U, circumflex accent */ 
  43.   "Ugrave",    /* capital U, grave accent */ 
  44.   "Uuml",    /* capital U, dieresis or umlaut mark */ 
  45.   "Yacute",    /* capital Y, acute accent */ 
  46.   "aacute",    /* small a, acute accent */ 
  47.   "acirc",    /* small a, circumflex accent */ 
  48.   "aelig",    /* small ae diphthong (ligature) */ 
  49.   "agrave",    /* small a, grave accent */ 
  50.   "amp",    /* ampersand */ 
  51.   "aring",    /* small a, ring */ 
  52.   "atilde",    /* small a, tilde */ 
  53.   "auml",    /* small a, dieresis or umlaut mark */ 
  54.   "ccedil",    /* small c, cedilla */ 
  55.   "eacute",    /* small e, acute accent */ 
  56.   "ecirc",    /* small e, circumflex accent */ 
  57.   "egrave",    /* small e, grave accent */ 
  58.   "eth",    /* small eth, Icelandic */ 
  59.   "euml",    /* small e, dieresis or umlaut mark */ 
  60.   "gt",        /* greater than */ 
  61.   "iacute",    /* small i, acute accent */ 
  62.   "icirc",    /* small i, circumflex accent */ 
  63.   "igrave",    /* small i, grave accent */ 
  64.   "iuml",    /* small i, dieresis or umlaut mark */ 
  65.   "lt",        /* less than */ 
  66.   "ntilde",    /* small n, tilde */ 
  67.   "oacute",    /* small o, acute accent */ 
  68.   "ocirc",    /* small o, circumflex accent */ 
  69.   "ograve",    /* small o, grave accent */ 
  70.   "oslash",    /* small o, slash */ 
  71.   "otilde",    /* small o, tilde */ 
  72.   "ouml",    /* small o, dieresis or umlaut mark */ 
  73.   "szlig",    /* small sharp s, German (sz ligature) */ 
  74.   "thorn",    /* small thorn, Icelandic */ 
  75.   "uacute",    /* small u, acute accent */ 
  76.   "ucirc",    /* small u, circumflex accent */ 
  77.   "ugrave",    /* small u, grave accent */ 
  78.   "uuml",    /* small u, dieresis or umlaut mark */ 
  79.   "yacute",    /* small y, acute accent */ 
  80.   "yuml",    /* small y, dieresis or umlaut mark */ 
  81. };
  82.  
  83. #define HTML_ENTITIES 65
  84.  
  85.  
  86. /*        Attribute Lists
  87. **        ---------------
  88. **
  89. **    Lists must be in alphatbetical order by attribute name
  90. **    The tag elements contain the number of attributes
  91. */
  92. static attr no_attr[] = 
  93.     {{ 0 }};
  94.  
  95. static attr a_attr[] = {            /* Anchor attributes */
  96.     { "HREF"},
  97.     { "NAME" },                /* Should be ID */
  98.     { "TITLE" },
  99.     { "TYPE" },
  100.     { "URN" },
  101.     { 0 }    /* Terminate list */
  102. };    
  103.  
  104. static attr img_attr[] = {            /* Anchor attributes */
  105.     { "SRC"},
  106.     { 0 }    /* Terminate list */
  107. };    
  108.  
  109. static attr list_attr[] = {
  110.     { "COMPACT"},
  111.     { 0 }    /* Terminate list */
  112. };
  113.  
  114. static attr glossary_attr[] = {
  115.     { "COMPACT" },
  116.     { 0 }    /* Terminate list */
  117. };
  118.  
  119. static attr nextid_attr[] = {
  120.     { "N" }
  121. };
  122.  
  123.  
  124. /*    Elements
  125. **    --------
  126. **
  127. **    Must match definitions in HTMLDTD.html!
  128. **    Must be in alphabetical order.
  129. **
  130. **    Name,     Attributes,         content
  131. */
  132. static HTTag tags[HTML_ELEMENTS] = {
  133.     { "A"    , a_attr,    HTML_A_ATTRIBUTES,    SGML_MIXED },
  134.     { "ADDRESS"    , no_attr,    0,        SGML_MIXED },
  135.     { "B"    , no_attr,    0,        SGML_MIXED },
  136.     { "BODY"    , no_attr,    0,        SGML_MIXED },
  137.     { "BLOCKQUOTE", no_attr,    0,        SGML_MIXED },
  138.     { "CITE"    , no_attr,    0,        SGML_MIXED },
  139.     { "CODE"    , no_attr,    0,        SGML_MIXED },
  140.     { "COMMENT",  no_attr,    0,        SGML_MIXED },
  141.     { "DD"    , no_attr,    0,        SGML_EMPTY },
  142.     { "DFN"    , no_attr,    0,        SGML_MIXED },
  143.     { "DIR"    , list_attr,    1,        SGML_MIXED },
  144.     { "DL"    , glossary_attr,1,        SGML_MIXED },
  145.     { "DLC"    , glossary_attr,1,        SGML_MIXED },
  146.     { "DT"    , no_attr,    0,        SGML_EMPTY },
  147.     { "EM"    , no_attr,    0,        SGML_MIXED },
  148.     { "HEAD"    , no_attr,    0,        SGML_MIXED },
  149.     { "H1"    , no_attr,    0,        SGML_MIXED },
  150.     { "H2"    , no_attr,    0,        SGML_MIXED },
  151.     { "H3"    , no_attr,    0,        SGML_MIXED },
  152.     { "H4"    , no_attr,    0,        SGML_MIXED },
  153.     { "H5"    , no_attr,    0,        SGML_MIXED },
  154.     { "H6"    , no_attr,    0,        SGML_MIXED },
  155.     { "H7"    , no_attr,    0,        SGML_MIXED },
  156.     { "HTML"    , no_attr,    0,        SGML_MIXED },
  157.     { "I"    , no_attr,    0,        SGML_MIXED },
  158.     { "IMG"     , img_attr,    0,        SGML_EMPTY },
  159.     { "ISINDEX" , no_attr,    0,        SGML_EMPTY },
  160.     { "KBD"    , no_attr,    0,        SGML_MIXED },
  161.     { "LI"    , list_attr,    1,        SGML_EMPTY },
  162.     { "LINK"    , a_attr,    HTML_A_ATTRIBUTES,    SGML_EMPTY },
  163.     { "LISTING"    , no_attr,    0,        SGML_LITTERAL },
  164.     { "NEXTID"  , nextid_attr,    1,        SGML_EMPTY },
  165.     { "MENU"    , list_attr,    1,        SGML_MIXED },
  166.     { "OL"    , list_attr,    1,        SGML_MIXED },
  167.     { "P"    , no_attr,    0,        SGML_EMPTY },
  168.     { "PLAINTEXT", no_attr,    0,        SGML_LITTERAL },
  169.     { "PRE"    , no_attr,    0,        SGML_MIXED },
  170.     { "SAMP"    , no_attr,    0,        SGML_MIXED },
  171.     { "STRONG"    , no_attr,    0,        SGML_MIXED },
  172.     { "TITLE",       no_attr,    0,        SGML_CDATA },
  173.     { "TT"    , no_attr,    0,        SGML_MIXED },
  174.     { "U"    , no_attr,    0,        SGML_MIXED },
  175.     { "UL"    , list_attr,    1,        SGML_MIXED },
  176.     { "VAR"    , no_attr,    0,        SGML_MIXED },
  177.     { "XMP"    , no_attr,    0,        SGML_LITTERAL },
  178. };
  179.  
  180.  
  181. PUBLIC CONST SGML_dtd HTML_dtd = {
  182.     tags,
  183.     HTML_ELEMENTS,
  184.     entities,
  185.     sizeof(entities)/sizeof(char**)
  186. };
  187.  
  188. /*    Utility Routine: useful for people building HTML objects */
  189.  
  190. /*    Start anchor element
  191. **    --------------------
  192. **
  193. **    It is kinda convenient to have a particulr routine for
  194. **    starting an anchor element, as everything else for HTML is
  195. **    simple anyway.
  196. */
  197. struct _HTStructured {
  198.     HTStructuredClass * isa;
  199.     /* ... */
  200. };
  201.  
  202.  
  203.