/** * cr_om_parser_simply_parse_buf: *@a_buf: the css2 in memory buffer. *@a_len: the length of the in memory buffer. *@a_enc: the encoding of the in memory buffer. *@a_result: out parameter. The resulting css2 style sheet. * *The simpler way to parse an in memory css2 buffer. * *Returns CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_om_parser_simply_parse_buf (const guchar * a_buf, gulong a_len, enum CREncoding a_enc, CRStyleSheet ** a_result) { CROMParser *parser = NULL; enum CRStatus status = CR_OK; parser = cr_om_parser_new (NULL); if (!parser) { cr_utils_trace_info ("Could not create om parser"); cr_utils_trace_info ("System possibly out of memory"); return CR_ERROR; } status = cr_om_parser_parse_buf (parser, a_buf, a_len, a_enc, a_result); if (parser) { cr_om_parser_destroy (parser); parser = NULL; } return status; }
/** *The test of the cr_input_read_byte() method. *Reads the each byte of a_file_uri using the *cr_input_read_byte() method. Each byte is send to *stdout. *@param a_file_uri the file to read. *@return CR_OK upon successfull completion of the *function, an error code otherwise. */ static enum CRStatus test_cr_parser_parse (void) { enum CRStatus status = CR_OK; CROMParser *parser = NULL; CRStyleSheet *stylesheet = NULL; parser = cr_om_parser_new (NULL); status = cr_om_parser_parse_buf (parser, (guchar *) gv_cssbuf, strlen (gv_cssbuf), CR_ASCII, &stylesheet); if (status == CR_OK && stylesheet) { cr_stylesheet_dump (stylesheet, stdout); cr_stylesheet_destroy (stylesheet); } cr_om_parser_destroy (parser); return status; }