domfs

Document Object Model as a filesystem for plan9 os
git clone git://nsmpr.xyz/domfs.git
Log | Files | Refs | README

html5dom.h (1384B)


      1 typedef struct Attr Attr;
      2 
      3 struct Attr{
      4 	String *name;
      5 	String *value;
      6 };
      7 
      8 enum { /* Token types */
      9 	TDOCT,
     10 	TSTART,
     11 	TEND,
     12 	TCOMM,
     13 	TCHAR,
     14 	TEOF = -1,
     15 };
     16 
     17 enum { /* Token flags */
     18 	TF_FORCE_QUIRKS = 1,
     19 	TF_SELF_CLOSING = 1 << 1,
     20 };
     21 
     22 typedef struct Token Token;
     23 
     24 struct Token {
     25 	int type;
     26 	u64int flags;
     27 	Rune c;
     28 	String *name;
     29 	Attr **attr;
     30 };
     31 
     32 Token* chartok(Rune);
     33 Token* eoftok(void);
     34 Token* newtok(int);
     35 void t_free(Token*);
     36 Attr* tnewattr(Token*);
     37 void attr_free(Attr*);
     38 
     39 /*
     40  * Insertion modes, as defined in
     41  * https://html.spec.whatwg.org/#the-insertion-mode
     42  */
     43 
     44 enum {
     45 	IMinitial = 0,
     46 	IMbefore_html = 1,
     47 	IMbefore_head = 1 << 1,
     48 	IMin_head = 1 << 2,
     49 	IMin_head_noscript = 1 << 3,
     50 	IMafter_head = 1 << 4,
     51 	IMin_body = 1 << 5,
     52 	IMtext = 1 << 6,
     53 	IMin_table = 1 << 7,
     54 	IMin_table_text = 1 << 8,
     55 	IMin_caption = 1 << 9,
     56 	IMin_column_group = 1 << 10,
     57 	IMin_table_body = 1 << 11,
     58 	IMin_row = 1 << 12,
     59 	IMin_cell = 1 << 13,
     60 	IMin_select = 1 << 14,
     61 	IMin_select_in_table = 1 << 15,
     62 	IMin_template = 1 << 16,
     63 	IMafter_body = 1 << 17,
     64 	IMin_frameset = 1 << 18,
     65 	IMafter_frameset = 1 << 19,
     66 	IMafter_after_body = 1 << 20,
     67 	IMafter_after_frameset = 1 << 21,
     68 };
     69 
     70 typedef struct Tokctl Tokctl;
     71 struct Tokctl {
     72 	Channel *c;
     73 };
     74 
     75 typedef struct Treeconstrctl Treeconstrctl;
     76 struct Treeconstrctl {
     77 	char *treeroot;
     78 	Channel *in;
     79 };
     80 
     81 void threadtokenize(void*);
     82 void threadtreeconstr(void*);