]>
Dogcows Code - chaz/openbox/blob - openbox/parse.c
3 static GHashTable
*reg
= NULL
;
10 void destshit(gpointer shit
) { g_free(shit
); }
14 reg
= g_hash_table_new_full(g_str_hash
, g_str_equal
, destshit
, destshit
);
20 g_hash_table_destroy(reg
);
23 void parse_reg_section(char *section
, ParseFunc func
, AssignParseFunc afunc
)
25 struct Functions
*f
= g_new(struct Functions
, 1);
28 g_hash_table_insert(reg
, g_ascii_strdown(section
, -1), f
);
31 void parse_free_token(ParseToken
*token
)
35 switch (token
->type
) {
37 g_free(token
->data
.string
);
39 case TOKEN_IDENTIFIER
:
40 g_free(token
->data
.identifier
);
43 for (it
= token
->data
.list
; it
; it
= it
->next
) {
44 parse_free_token(it
->data
);
47 g_list_free(token
->data
.list
);
60 void parse_set_section(char *section
)
63 sec
= g_ascii_strdown(section
, -1);
64 funcs
= g_hash_table_lookup(reg
, sec
);
68 void parse_token(ParseToken
*token
)
73 else if (token
->type
!= TOKEN_NEWLINE
)
74 yyerror("syntax error");
78 void parse_assign(char *name
, ParseToken
*value
)
82 funcs
->af(name
, value
);
84 yyerror("syntax error");
This page took 0.039879 seconds and 4 git commands to generate.