diff options
author | Dodji Seketeli <dodji@src.gnome.org> | 2003-03-20 21:29:07 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@src.gnome.org> | 2003-03-20 21:29:07 +0000 |
commit | 3e55266839340793845b8527b65542d1e4b5fc11 (patch) | |
tree | 68df3276dd14404867e9716856d6be1a1907fd61 /src/cr-om-parser.c | |
parent | a189ebbcc9b05cda2ea77f84db8a65855f5b3fb7 (diff) | |
download | libcroco-3e55266839340793845b8527b65542d1e4b5fc11.tar.gz |
fixed a small bug in the tokenizer.
Provided better support for in memory data parsing.
Diffstat (limited to 'src/cr-om-parser.c')
-rw-r--r-- | src/cr-om-parser.c | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/src/cr-om-parser.c b/src/cr-om-parser.c index 72561ac..e7b4c65 100644 --- a/src/cr-om-parser.c +++ b/src/cr-om-parser.c @@ -844,6 +844,53 @@ cr_om_parser_new (CRInput *a_input) enum CRStatus +cr_om_parser_parse_buf (CROMParser *a_this, + guchar *a_buf, + gulong a_len, + enum CREncoding a_enc, + CRStyleSheet **a_result) +{ + + enum CRStatus status = CR_OK ; + + g_return_val_if_fail (a_this && a_result, CR_BAD_PARAM_ERROR) ; + + if (!PRIVATE (a_this)->parser) + { + PRIVATE (a_this)->parser = cr_parser_new (NULL) ; + } + + status = cr_parser_parse_buf (PRIVATE (a_this)->parser, + a_buf, a_len, a_enc) ; + + if (status == CR_OK) + { + CRDocHandler *sac_handler = NULL ; + cr_parser_get_sac_handler (PRIVATE (a_this)->parser, + &sac_handler) ; + g_return_val_if_fail (sac_handler, CR_ERROR) ; + + if (sac_handler->result) + *a_result = sac_handler->result ; + } + + return status ; +} + + +/** + *Parses a css2 stylesheet contained + *in a file. + *@param a_this the current instance of the cssom parser. + *@param a_file_uri the uri of the file. + *(only local file paths are suppported so far) + *@param a_enc the encoding of the file. + *@param a_result out parameter. A pointer + *the build css object model. + *@param CR_OK upon successfull completion, an error code + *otherwise. + */ +enum CRStatus cr_om_parser_parse_file (CROMParser *a_this, guchar *a_file_uri, enum CREncoding a_enc, @@ -860,8 +907,8 @@ cr_om_parser_parse_file (CROMParser *a_this, (a_file_uri, a_enc) ; } - status = cr_parser_parse_from_file (PRIVATE (a_this)->parser, - a_file_uri, a_enc) ; + status = cr_parser_parse_file (PRIVATE (a_this)->parser, + a_file_uri, a_enc) ; if (status == CR_OK) { |