40 #define PRIVATE(a_this) ((a_this)->priv) 60 gboolean a_important);
93 GList * a_media_list);
112 new_parsing_context (
void)
128 g_return_if_fail (a_ctxt);
142 cr_om_parser_init_default_sac_handler (
CROMParser * a_this)
145 gboolean created_handler = FALSE;
148 g_return_val_if_fail (a_this &&
PRIVATE (a_this)
154 g_return_val_if_fail (status ==
CR_OK, status);
158 created_handler = TRUE;
164 sac_handler->start_document = start_document;
165 sac_handler->end_document = end_document;
166 sac_handler->start_selector = start_selector;
167 sac_handler->end_selector = end_selector;
168 sac_handler->property = property;
169 sac_handler->start_font_face = start_font_face;
170 sac_handler->end_font_face = end_font_face;
171 sac_handler->error = error;
172 sac_handler->unrecoverable_error = unrecoverable_error;
173 sac_handler->charset = charset;
174 sac_handler->start_page = start_page;
175 sac_handler->end_page = end_page;
176 sac_handler->start_media = start_media;
177 sac_handler->end_media = end_media;
178 sac_handler->import_style = import_style;
180 if (created_handler) {
196 g_return_if_fail (a_this);
198 ctxt = new_parsing_context ();
199 g_return_if_fail (ctxt);
214 g_return_if_fail (a_this);
216 g_return_if_fail (a_this);
219 g_return_if_fail (status ==
CR_OK && ctxt);
220 g_return_if_fail (ctxt->
cur_stmt == NULL);
236 g_return_if_fail (a_this);
238 g_return_if_fail (a_this);
241 g_return_if_fail (status ==
CR_OK && ctxt);
278 g_return_if_fail (a_this);
281 g_return_if_fail (status ==
CR_OK && ctxt);
287 g_return_if_fail (status ==
CR_OK);
290 destroy_context (ctxt);
297 destroy_context (ctxt);
313 g_return_if_fail (a_this);
316 g_return_if_fail (status ==
CR_OK && ctxt);
321 g_return_if_fail (stmt);
347 g_return_if_fail (a_this);
350 g_return_if_fail (status ==
CR_OK && ctxt);
351 g_return_if_fail (ctxt->
cur_stmt == NULL);
390 (void) a_pseudo_page;
392 g_return_if_fail (a_this);
397 g_return_if_fail (status ==
CR_OK && ctxt);
417 a_pseudo_page = NULL;
422 GList * a_media_list,
428 GList *media_list = NULL;
430 g_return_if_fail (a_this);
433 g_return_if_fail (status ==
CR_OK && ctxt);
435 g_return_if_fail (ctxt
460 g_return_if_fail (a_this);
465 g_return_if_fail (status ==
CR_OK && ctxt);
467 g_return_if_fail (ctxt
490 GList * a_media_list,
501 GList *media_list = NULL ;
503 (void) a_uri_default_ns;
505 g_return_if_fail (a_this);
510 g_return_if_fail (status ==
CR_OK && ctxt);
553 a_uri_default_ns = NULL;
563 g_return_if_fail (a_this);
566 g_return_if_fail (status ==
CR_OK && ctxt);
574 (ctxt->
stylesheet, a_selector_list, NULL, NULL);
584 (void) a_selector_list;
586 g_return_if_fail (a_this);
591 g_return_if_fail (status ==
CR_OK && ctxt);
608 (
"Could not append a new statement");
622 (
"Could not append a new statement");
633 a_selector_list = NULL;
640 gboolean a_important)
649 g_return_if_fail (a_this);
652 g_return_if_fail (status ==
CR_OK && ctxt);
667 g_return_if_fail (str);
672 g_return_if_fail (decl);
686 (
"Could not append decl to ruleset");
701 (
"Could not append decl to ruleset");
714 (
"Could not append decl to ruleset");
748 g_return_if_fail (a_this);
751 g_return_if_fail (status ==
CR_OK && ctxt);
768 g_return_if_fail (status ==
CR_OK);
774 g_return_if_fail (status ==
CR_OK);
817 if (!
PRIVATE (result)->parser) {
822 status = cr_om_parser_init_default_sac_handler (result);
824 if (status !=
CR_OK) {
853 const guchar * a_buf,
862 if (!
PRIVATE (a_this)->parser) {
867 a_buf, a_len, a_enc);
869 if (status ==
CR_OK) {
876 g_return_val_if_fail (sac_handler,
CR_ERROR);
879 (gpointer *) resultptr);
880 g_return_val_if_fail (status ==
CR_OK, status);
943 const guchar * a_file_uri,
948 g_return_val_if_fail (a_this && a_file_uri && a_result,
951 if (!
PRIVATE (a_this)->parser) {
959 if (status ==
CR_OK) {
966 g_return_val_if_fail (sac_handler,
CR_ERROR);
969 (sac_handler, (gpointer *) resultptr);
970 g_return_val_if_fail (status ==
CR_OK, status);
1032 const guchar * a_author_path,
1033 const guchar * a_user_path,
1034 const guchar * a_ua_path,
1049 paths[0] = (guchar *) a_author_path;
1050 paths[1] = (guchar *) a_user_path;
1051 paths[2] = (guchar *) a_ua_path;
1053 for (i = 0; i < 3; i++) {
1055 a_encoding, &sheets[i]);
1056 if (status !=
CR_OK) {
1066 for (i = 0; i < 3; i++) {
1091 const guchar * a_user_path,
1092 const guchar * a_ua_path,
1109 a_encoding, a_result);
1126 g_return_if_fail (a_this &&
PRIVATE (a_this));
1128 if (
PRIVATE (a_this)->parser) {
1130 PRIVATE (a_this)->parser = NULL;
CRStatement * cr_statement_new_at_import_rule(CRStyleSheet *a_container_sheet, CRString *a_url, GList *a_media_list, CRStyleSheet *a_imported_sheet)
cr_statement_new_at_import_rule:
CRDeclaration * decl_list
A list of instances of CRDeclaration.
CRAtMediaRule * media_rule
union _CRStatement::@1 kind
enum CRStatus cr_parser_get_sac_handler(CRParser *a_this, CRDocHandler **a_handler)
cr_parser_get_sac_handler: @a_this: the "this pointer" of the current instance of CRParser.
CRAtFontFaceRule * font_face_rule
The implementation of the SAC parser.
CRStatement * cur_media_stmt
enum CRStatus cr_doc_handler_set_ctxt(CRDocHandler *a_this, gpointer a_ctxt)
cr_doc_handler_set_ctxt: @a_this: the current instance of CRDocHandler @a_ctxt: a pointer to the pars...
enum CRStatus cr_om_parser_parse_buf(CROMParser *a_this, const guchar *a_buf, gulong a_len, enum CREncoding a_enc, CRStyleSheet **a_result)
cr_om_parser_parse_buf: @a_this: the current instance of CROMParser.
void cr_statement_destroy(CRStatement *a_this)
cr_statement_destroy:
CRStatement * statements
The css statements list.
void cr_declaration_destroy(CRDeclaration *a_this)
cr_declaration_destroy: @a_this: the current instance of CRDeclaration.
An abstraction of a css stylesheet as defined by the css2 spec in chapter 4.
The Croco library basic types definitions And global definitions.
CRParser * cr_parser_new(CRTknzr *a_tknzr)
cr_parser_new: @a_tknzr: the tokenizer to use for the parsing.
enum CRStatus cr_parser_set_sac_handler(CRParser *a_this, CRDocHandler *a_handler)
cr_parser_set_sac_handler: @a_this: the "this pointer" of the current instance of CRParser.
void cr_string_destroy(CRString *a_this)
enum CRStatus cr_parser_parse_file(CRParser *a_this, const guchar *a_file_uri, enum CREncoding a_enc)
cr_parser_parse_file: @a_this: a pointer to the current instance of CRParser.
CREncoding
Encoding values.
CRDeclaration * decl_list
typedefG_BEGIN_DECLS struct _CRSelector CRSelector
enum CRStatus cr_doc_handler_get_ctxt(CRDocHandler const *a_this, gpointer *a_ctxt)
cr_doc_handler_get_ctxt: @a_this: the current instance of CRDocHandler.
enum CRStatus cr_doc_handler_set_result(CRDocHandler *a_this, gpointer a_result)
cr_doc_handler_set_result: @a_this: the current instance of CRDocHandler @a_result: the new result.
CRStatus
The status type returned by the methods of the croco library.
enum CRStatementType type
The type of the statement.
CRStatement * cr_statement_new_at_media_rule(CRStyleSheet *a_sheet, CRStatement *a_rulesets, GList *a_media)
cr_statement_new_at_media_rule:
typedefG_BEGIN_DECLS struct _CRDocHandler CRDocHandler
CRParser * cr_parser_new_from_input(CRInput *a_input)
cr_parser_new_from_input: @a_input: the parser input stream to use.
CRDeclaration * cr_declaration_append(CRDeclaration *a_this, CRDeclaration *a_new)
cr_declaration_append: @a_this: the current declaration list.
CRParser * cr_parser_new_from_file(const guchar *a_file_uri, enum CREncoding a_enc)
cr_parser_new_from_file: @a_file_uri: the uri of the file to parse.
GList * cr_utils_dup_glist_of_cr_string(GList const *a_list_of_strings)
Duplicate a GList where the GList::data is a CRString.
The abstraction of css statement as defined in the chapter 4 and appendix D.1 of the css2 spec.
CRStyleSheet * stylesheet
enum CRStatus cr_doc_handler_get_result(CRDocHandler const *a_this, gpointer *a_result)
cr_doc_handler_get_result: @a_this: the current instance of CRDocHandler @a_result: out parameter.
The definition of the CSS Object Model Parser.
CRString * cr_string_dup(CRString const *a_this)
CRStatement * cr_statement_append(CRStatement *a_this, CRStatement *a_new)
cr_statement_append:
gboolean cr_doc_handler_unref(CRDocHandler *a_this)
cr_doc_handler_unref: @a_this: the currrent instance of CRDocHandler.
typedefG_BEGIN_DECLS struct _CRString CRString
gboolean cr_stylesheet_unref(CRStyleSheet *a_this)
CRStatement * cr_statement_new_at_font_face_rule(CRStyleSheet *a_sheet, CRDeclaration *a_font_decls)
cr_statement_new_at_font_face_rule:
enum CRStatus cr_om_parser_simply_parse_paths_to_cascade(const guchar *a_author_path, const guchar *a_user_path, const guchar *a_ua_path, enum CREncoding a_encoding, CRCascade **a_result)
cr_om_parser_simply_parse_paths_to_cascade: @a_author_path: the path to the author stylesheet @a_user...
enum CRStatus cr_parser_parse_buf(CRParser *a_this, const guchar *a_buf, gulong a_len, enum CREncoding a_enc)
cr_parser_parse_buf: @a_this: the current instance of #CRparser @a_buf: the input buffer @a_len: the ...
CRCascade * cr_cascade_new(CRStyleSheet *a_author_sheet, CRStyleSheet *a_user_sheet, CRStyleSheet *a_ua_sheet)
cr_cascade_new: @a_author_sheet: the author origin style sheet.
void cr_stylesheet_destroy(CRStyleSheet *a_this)
Destructor of the CRStyleSheet class.
CROMParser * cr_om_parser_new(CRInput *a_input)
cr_om_parser_new: @a_input: the input stream.
CRDeclaration * cr_declaration_new(CRStatement *a_statement, CRString *a_property, CRTerm *a_value)
cr_declaration_new: @a_statement: the statement this declaration belongs to.
An abstraction of a css2 term as defined in the CSS2 spec in appendix D.1: term ::= [ NUMBER S* | PER...
enum CRStatus cr_om_parser_parse_file(CROMParser *a_this, const guchar *a_file_uri, enum CREncoding a_enc, CRStyleSheet **a_result)
cr_om_parser_parse_file: @a_this: the current instance of the cssom parser.
void cr_parser_destroy(CRParser *a_this)
cr_parser_destroy: @a_this: the current instance of CRParser to destroy.
void cr_om_parser_destroy(CROMParser *a_this)
cr_om_parser_destroy: @a_this: the current instance of CROMParser.
typedefG_BEGIN_DECLS struct _CROMParser CROMParser
enum CRStatus cr_om_parser_parse_paths_to_cascade(CROMParser *a_this, const guchar *a_author_path, const guchar *a_user_path, const guchar *a_ua_path, enum CREncoding a_encoding, CRCascade **a_result)
cr_om_parser_parse_paths_to_cascade: @a_this: the current instance of CROMParser @a_author_path: the ...
enum CRStatus cr_om_parser_simply_parse_file(const guchar *a_file_path, enum CREncoding a_enc, CRStyleSheet **a_result)
cr_om_parser_simply_parse_file: @a_file_path: the css2 local file path.
CRStatement * cr_statement_new_at_charset_rule(CRStyleSheet *a_sheet, CRString *a_charset)
cr_statement_new_at_charset_rule:
enum CRStatus cr_om_parser_simply_parse_buf(const guchar *a_buf, gulong a_len, enum CREncoding a_enc, CRStyleSheet **a_result)
cr_om_parser_simply_parse_buf: @a_buf: the css2 in memory buffer.
CRStatement * cr_statement_new_ruleset(CRStyleSheet *a_sheet, CRSelector *a_sel_list, CRDeclaration *a_decl_list, CRStatement *a_parent_media_rule)
cr_statement_new_ruleset:
CRStyleSheet * cr_stylesheet_new(CRStatement *a_stmts)
Constructor of the CRStyleSheet class.
CRDocHandler * cr_doc_handler_new(void)
cr_doc_handler_new: Constructor of CRDocHandler.
#define cr_utils_trace_info(a_msg)
Traces an info message.
CRStatement * cr_statement_new_at_page_rule(CRStyleSheet *a_sheet, CRDeclaration *a_decl_list, CRString *a_name, CRString *a_pseudo)
cr_statement_new_at_page_rule: