Libcroco
cr-om-parser.c
Go to the documentation of this file.
1 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
2 
3 /*
4  * This file is part of The Croco Library
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of version 2.1 of the GNU Lesser General Public
8  * License as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA
19  *
20  * Author: Dodji Seketeli
21  * See COPYRIGHTS file for copyright information.
22  */
23 
24 #include <string.h>
25 #include "cr-utils.h"
26 #include "cr-om-parser.h"
27 
28 /**
29  *@CROMParser:
30  *
31  *The definition of the CSS Object Model Parser.
32  *This parser uses (and sits) the SAC api of libcroco defined
33  *in cr-parser.h and cr-doc-handler.h
34  */
35 
38 };
39 
40 #define PRIVATE(a_this) ((a_this)->priv)
41 
42 /*
43  *Forward declaration of a type defined later
44  *in this file.
45  */
46 struct _ParsingContext;
48 
49 static ParsingContext *new_parsing_context (void);
50 
51 static void destroy_context (ParsingContext * a_ctxt);
52 
53 static void unrecoverable_error (CRDocHandler * a_this);
54 
55 static void error (CRDocHandler * a_this);
56 
57 static void property (CRDocHandler * a_this,
58  CRString * a_name,
59  CRTerm * a_expression,
60  gboolean a_important);
61 
62 static void end_selector (CRDocHandler * a_this,
63  CRSelector * a_selector_list);
64 
65 static void start_selector (CRDocHandler * a_this,
66  CRSelector * a_selector_list);
67 
68 static void start_font_face (CRDocHandler * a_this,
69  CRParsingLocation *a_location);
70 
71 static void end_font_face (CRDocHandler * a_this);
72 
73 static void end_document (CRDocHandler * a_this);
74 
75 static void start_document (CRDocHandler * a_this);
76 
77 static void charset (CRDocHandler * a_this,
78  CRString * a_charset,
79  CRParsingLocation *a_location);
80 
81 static void start_page (CRDocHandler * a_this, CRString * a_page,
82  CRString * a_pseudo_page,
83  CRParsingLocation *a_location);
84 
85 static void end_page (CRDocHandler * a_this, CRString * a_page,
86  CRString * a_pseudo_page);
87 
88 static void start_media (CRDocHandler * a_this,
89  GList * a_media_list,
90  CRParsingLocation *a_location);
91 
92 static void end_media (CRDocHandler * a_this,
93  GList * a_media_list);
94 
95 static void import_style (CRDocHandler * a_this,
96  GList * a_media_list,
97  CRString * a_uri,
98  CRString * a_uri_default_ns,
99  CRParsingLocation *a_location);
100 
105 };
106 
107 /********************************************
108  *Private methods
109  ********************************************/
110 
111 static ParsingContext *
112 new_parsing_context (void)
113 {
114  ParsingContext *result = NULL;
115 
116  result = g_try_malloc (sizeof (ParsingContext));
117  if (!result) {
118  cr_utils_trace_info ("Out of Memory");
119  return NULL;
120  }
121  memset (result, 0, sizeof (ParsingContext));
122  return result;
123 }
124 
125 static void
126 destroy_context (ParsingContext * a_ctxt)
127 {
128  g_return_if_fail (a_ctxt);
129 
130  if (a_ctxt->stylesheet) {
132  a_ctxt->stylesheet = NULL;
133  }
134  if (a_ctxt->cur_stmt) {
135  cr_statement_destroy (a_ctxt->cur_stmt);
136  a_ctxt->cur_stmt = NULL;
137  }
138  g_free (a_ctxt);
139 }
140 
141 static enum CRStatus
142 cr_om_parser_init_default_sac_handler (CROMParser * a_this)
143 {
144  CRDocHandler *sac_handler = NULL;
145  gboolean created_handler = FALSE;
146  enum CRStatus status = CR_OK;
147 
148  g_return_val_if_fail (a_this && PRIVATE (a_this)
149  && PRIVATE (a_this)->parser,
151 
152  status = cr_parser_get_sac_handler (PRIVATE (a_this)->parser,
153  &sac_handler);
154  g_return_val_if_fail (status == CR_OK, status);
155 
156  if (!sac_handler) {
157  sac_handler = cr_doc_handler_new ();
158  created_handler = TRUE;
159  }
160 
161  /*
162  *initialyze here the sac handler.
163  */
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;
179 
180  if (created_handler) {
181  status = cr_parser_set_sac_handler (PRIVATE (a_this)->parser,
182  sac_handler);
183  cr_doc_handler_unref (sac_handler);
184  }
185 
186  return status;
187 
188 }
189 
190 static void
191 start_document (CRDocHandler * a_this)
192 {
193  ParsingContext *ctxt = NULL;
194  CRStyleSheet *stylesheet = NULL;
195 
196  g_return_if_fail (a_this);
197 
198  ctxt = new_parsing_context ();
199  g_return_if_fail (ctxt);
200 
201  stylesheet = cr_stylesheet_new (NULL);
202  ctxt->stylesheet = stylesheet;
203  cr_doc_handler_set_ctxt (a_this, ctxt);
204 }
205 
206 static void
207 start_font_face (CRDocHandler * a_this,
208  CRParsingLocation *a_location)
209 {
210  enum CRStatus status = CR_OK;
211  ParsingContext *ctxt = NULL;
212  ParsingContext **ctxtptr = NULL;
213 
214  g_return_if_fail (a_this);
215 
216  g_return_if_fail (a_this);
217  ctxtptr = &ctxt;
218  status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
219  g_return_if_fail (status == CR_OK && ctxt);
220  g_return_if_fail (ctxt->cur_stmt == NULL);
221 
222  ctxt->cur_stmt =
224 
225  g_return_if_fail (ctxt->cur_stmt);
226 }
227 
228 static void
229 end_font_face (CRDocHandler * a_this)
230 {
231  enum CRStatus status = CR_OK;
232  ParsingContext *ctxt = NULL;
233  ParsingContext **ctxtptr = NULL;
234  CRStatement *stmts = NULL;
235 
236  g_return_if_fail (a_this);
237 
238  g_return_if_fail (a_this);
239  ctxtptr = &ctxt;
240  status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
241  g_return_if_fail (status == CR_OK && ctxt);
242  g_return_if_fail
243  (ctxt->cur_stmt
245  && ctxt->stylesheet);
246 
247  stmts = cr_statement_append (ctxt->stylesheet->statements,
248  ctxt->cur_stmt);
249  if (!stmts)
250  goto error;
251 
252  ctxt->stylesheet->statements = stmts;
253  stmts = NULL;
254  ctxt->cur_stmt = NULL;
255 
256  return;
257 
258  error:
259 
260  if (ctxt->cur_stmt) {
262  ctxt->cur_stmt = NULL;
263  }
264 
265  if (!stmts) {
266  cr_statement_destroy (stmts);
267  stmts = NULL;
268  }
269 }
270 
271 static void
272 end_document (CRDocHandler * a_this)
273 {
274  enum CRStatus status = CR_OK;
275  ParsingContext *ctxt = NULL;
276  ParsingContext **ctxtptr = NULL;
277 
278  g_return_if_fail (a_this);
279  ctxtptr = &ctxt;
280  status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
281  g_return_if_fail (status == CR_OK && ctxt);
282 
283  if (!ctxt->stylesheet || ctxt->cur_stmt)
284  goto error;
285 
286  status = cr_doc_handler_set_result (a_this, ctxt->stylesheet);
287  g_return_if_fail (status == CR_OK);
288 
289  ctxt->stylesheet = NULL;
290  destroy_context (ctxt);
291  cr_doc_handler_set_ctxt (a_this, NULL);
292 
293  return;
294 
295  error:
296  if (ctxt) {
297  destroy_context (ctxt);
298  }
299 }
300 
301 static void
302 charset (CRDocHandler * a_this, CRString * a_charset,
303  CRParsingLocation *a_location)
304 {
305  enum CRStatus status = CR_OK;
306  CRStatement *stmt = NULL,
307  *stmt2 = NULL;
308  CRString *charset = NULL;
309 
310  ParsingContext *ctxt = NULL;
311  ParsingContext **ctxtptr = NULL;
312 
313  g_return_if_fail (a_this);
314  ctxtptr = &ctxt;
315  status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
316  g_return_if_fail (status == CR_OK && ctxt);
317  g_return_if_fail (ctxt->stylesheet);
318 
319  charset = cr_string_dup (a_charset) ;
320  stmt = cr_statement_new_at_charset_rule (ctxt->stylesheet, charset);
321  g_return_if_fail (stmt);
322  stmt2 = cr_statement_append (ctxt->stylesheet->statements, stmt);
323  if (!stmt2) {
324  if (stmt) {
325  cr_statement_destroy (stmt);
326  stmt = NULL;
327  }
328  if (charset) {
329  cr_string_destroy (charset);
330  }
331  return;
332  }
333  ctxt->stylesheet->statements = stmt2;
334  stmt2 = NULL;
335 }
336 
337 static void
338 start_page (CRDocHandler * a_this,
339  CRString * a_page,
340  CRString * a_pseudo,
341  CRParsingLocation *a_location)
342 {
343  enum CRStatus status = CR_OK;
344  ParsingContext *ctxt = NULL;
345  ParsingContext **ctxtptr = NULL;
346 
347  g_return_if_fail (a_this);
348  ctxtptr = &ctxt;
349  status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
350  g_return_if_fail (status == CR_OK && ctxt);
351  g_return_if_fail (ctxt->cur_stmt == NULL);
352 
354  (ctxt->stylesheet, NULL, NULL, NULL);
355  if (a_page) {
356  ctxt->cur_stmt->kind.page_rule->name =
357  cr_string_dup (a_page) ;
358 
359  if (!ctxt->cur_stmt->kind.page_rule->name) {
360  goto error;
361  }
362  }
363  if (a_pseudo) {
364  ctxt->cur_stmt->kind.page_rule->pseudo =
365  cr_string_dup (a_pseudo) ;
366  if (!ctxt->cur_stmt->kind.page_rule->pseudo) {
367  goto error;
368  }
369  }
370  return;
371 
372  error:
373  if (ctxt->cur_stmt) {
375  ctxt->cur_stmt = NULL;
376  }
377 }
378 
379 static void
380 end_page (CRDocHandler * a_this,
381  CRString * a_page,
382  CRString * a_pseudo_page)
383 {
384  enum CRStatus status = CR_OK;
385  ParsingContext *ctxt = NULL;
386  ParsingContext **ctxtptr = NULL;
387  CRStatement *stmt = NULL;
388 
389  (void) a_page;
390  (void) a_pseudo_page;
391 
392  g_return_if_fail (a_this);
393 
394  ctxtptr = &ctxt;
395  status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
396 
397  g_return_if_fail (status == CR_OK && ctxt);
398 
399  g_return_if_fail (ctxt->cur_stmt
400  && ctxt->cur_stmt->type == AT_PAGE_RULE_STMT
401  && ctxt->stylesheet);
402 
404  ctxt->cur_stmt);
405 
406  if (stmt) {
407  ctxt->stylesheet->statements = stmt;
408  stmt = NULL;
409  ctxt->cur_stmt = NULL;
410  }
411 
412  if (ctxt->cur_stmt) {
414  ctxt->cur_stmt = NULL;
415  }
416  a_page = NULL; /*keep compiler happy */
417  a_pseudo_page = NULL; /*keep compiler happy */
418 }
419 
420 static void
421 start_media (CRDocHandler * a_this,
422  GList * a_media_list,
423  CRParsingLocation *a_location)
424 {
425  enum CRStatus status = CR_OK;
426  ParsingContext *ctxt = NULL;
427  ParsingContext **ctxtptr = NULL;
428  GList *media_list = NULL;
429 
430  g_return_if_fail (a_this);
431  ctxtptr = &ctxt;
432  status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
433  g_return_if_fail (status == CR_OK && ctxt);
434 
435  g_return_if_fail (ctxt
436  && ctxt->cur_stmt == NULL
437  && ctxt->cur_media_stmt == NULL
438  && ctxt->stylesheet);
439  if (a_media_list) {
440  /*duplicate the media_list */
441  media_list = cr_utils_dup_glist_of_cr_string
442  (a_media_list);
443  }
444  ctxt->cur_media_stmt =
446  (ctxt->stylesheet, NULL, media_list);
447 
448 }
449 
450 static void
451 end_media (CRDocHandler * a_this, GList * a_media_list)
452 {
453  enum CRStatus status = CR_OK;
454  ParsingContext *ctxt = NULL;
455  ParsingContext **ctxtptr = NULL;
456  CRStatement *stmts = NULL;
457 
458  (void) a_media_list;
459 
460  g_return_if_fail (a_this);
461 
462  ctxtptr = &ctxt;
463  status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
464 
465  g_return_if_fail (status == CR_OK && ctxt);
466 
467  g_return_if_fail (ctxt
468  && ctxt->cur_media_stmt
470  && ctxt->stylesheet);
471 
472  stmts = cr_statement_append (ctxt->stylesheet->statements,
473  ctxt->cur_media_stmt);
474 
475  if (!stmts) {
477  ctxt->cur_media_stmt = NULL;
478  }
479 
480  ctxt->stylesheet->statements = stmts;
481  stmts = NULL;
482 
483  ctxt->cur_stmt = NULL ;
484  ctxt->cur_media_stmt = NULL ;
485  a_media_list = NULL;
486 }
487 
488 static void
489 import_style (CRDocHandler * a_this,
490  GList * a_media_list,
491  CRString * a_uri,
492  CRString * a_uri_default_ns,
493  CRParsingLocation *a_location)
494 {
495  enum CRStatus status = CR_OK;
496  CRString *uri = NULL;
497  CRStatement *stmt = NULL,
498  *stmt2 = NULL;
499  ParsingContext *ctxt = NULL;
500  ParsingContext **ctxtptr = NULL;
501  GList *media_list = NULL ;
502 
503  (void) a_uri_default_ns;
504 
505  g_return_if_fail (a_this);
506 
507  ctxtptr = &ctxt;
508  status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
509 
510  g_return_if_fail (status == CR_OK && ctxt);
511 
512  g_return_if_fail (ctxt->stylesheet);
513 
514  uri = cr_string_dup (a_uri) ;
515 
516  if (a_media_list)
517  media_list = cr_utils_dup_glist_of_cr_string (a_media_list) ;
518 
520  (ctxt->stylesheet, uri, media_list, NULL);
521 
522  if (!stmt)
523  goto error;
524 
525  if (ctxt->cur_stmt) {
526  stmt2 = cr_statement_append (ctxt->cur_stmt, stmt);
527  if (!stmt2)
528  goto error;
529  ctxt->cur_stmt = stmt2;
530  stmt2 = NULL;
531  stmt = NULL;
532  } else {
533  stmt2 = cr_statement_append (ctxt->stylesheet->statements,
534  stmt);
535  if (!stmt2)
536  goto error;
537  ctxt->stylesheet->statements = stmt2;
538  stmt2 = NULL;
539  stmt = NULL;
540  }
541 
542  return;
543 
544  error:
545  if (uri) {
546  cr_string_destroy (uri);
547  }
548 
549  if (stmt) {
550  cr_statement_destroy (stmt);
551  stmt = NULL;
552  }
553  a_uri_default_ns = NULL; /*keep compiler happy */
554 }
555 
556 static void
557 start_selector (CRDocHandler * a_this, CRSelector * a_selector_list)
558 {
559  enum CRStatus status = CR_OK ;
560  ParsingContext *ctxt = NULL;
561  ParsingContext **ctxtptr = NULL;
562 
563  g_return_if_fail (a_this);
564  ctxtptr = &ctxt;
565  status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
566  g_return_if_fail (status == CR_OK && ctxt);
567  if (ctxt->cur_stmt) {
568  /*hmm, this should be NULL so free it */
570  ctxt->cur_stmt = NULL;
571  }
572 
574  (ctxt->stylesheet, a_selector_list, NULL, NULL);
575 }
576 
577 static void
578 end_selector (CRDocHandler * a_this, CRSelector * a_selector_list)
579 {
580  enum CRStatus status = CR_OK;
581  ParsingContext *ctxt = NULL;
582  ParsingContext **ctxtptr = NULL;
583 
584  (void) a_selector_list;
585 
586  g_return_if_fail (a_this);
587 
588  ctxtptr = &ctxt;
589  status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
590 
591  g_return_if_fail (status == CR_OK && ctxt);
592 
593  g_return_if_fail (ctxt->cur_stmt && ctxt->stylesheet);
594 
595  if (ctxt->cur_stmt) {
596  CRStatement *stmts = NULL;
597 
598  if (ctxt->cur_media_stmt) {
599  CRAtMediaRule *media_rule = NULL;
600 
601  media_rule = ctxt->cur_media_stmt->kind.media_rule;
602 
603  stmts = cr_statement_append
604  (media_rule->rulesets, ctxt->cur_stmt);
605 
606  if (!stmts) {
608  ("Could not append a new statement");
609  cr_statement_destroy (media_rule->rulesets);
610  ctxt->cur_media_stmt->
611  kind.media_rule->rulesets = NULL;
612  return;
613  }
614  media_rule->rulesets = stmts;
615  ctxt->cur_stmt = NULL;
616  } else {
617  stmts = cr_statement_append
618  (ctxt->stylesheet->statements,
619  ctxt->cur_stmt);
620  if (!stmts) {
622  ("Could not append a new statement");
624  ctxt->cur_stmt = NULL;
625  return;
626  }
627  ctxt->stylesheet->statements = stmts;
628  ctxt->cur_stmt = NULL;
629  }
630 
631  }
632 
633  a_selector_list = NULL; /*keep compiler happy */
634 }
635 
636 static void
637 property (CRDocHandler * a_this,
638  CRString * a_name,
639  CRTerm * a_expression,
640  gboolean a_important)
641 {
642  enum CRStatus status = CR_OK;
643  ParsingContext *ctxt = NULL;
644  ParsingContext **ctxtptr = NULL;
645  CRDeclaration *decl = NULL,
646  *decl2 = NULL;
647  CRString *str = NULL;
648 
649  g_return_if_fail (a_this);
650  ctxtptr = &ctxt;
651  status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
652  g_return_if_fail (status == CR_OK && ctxt);
653 
654  /*
655  *make sure a current ruleset statement has been allocated
656  *already.
657  */
658  g_return_if_fail
659  (ctxt->cur_stmt
660  &&
661  (ctxt->cur_stmt->type == RULESET_STMT
663  || ctxt->cur_stmt->type == AT_PAGE_RULE_STMT));
664 
665  if (a_name) {
666  str = cr_string_dup (a_name);
667  g_return_if_fail (str);
668  }
669 
670  /*instanciates a new declaration */
671  decl = cr_declaration_new (ctxt->cur_stmt, str, a_expression);
672  g_return_if_fail (decl);
673  str = NULL;
674  decl->important = a_important;
675  /*
676  *add the new declaration to the current statement
677  *being build.
678  */
679  switch (ctxt->cur_stmt->type) {
680  case RULESET_STMT:
681  decl2 = cr_declaration_append
682  (ctxt->cur_stmt->kind.ruleset->decl_list, decl);
683  if (!decl2) {
684  cr_declaration_destroy (decl);
686  ("Could not append decl to ruleset");
687  goto error;
688  }
689  ctxt->cur_stmt->kind.ruleset->decl_list = decl2;
690  decl = NULL;
691  decl2 = NULL;
692  break;
693 
695  decl2 = cr_declaration_append
697  decl);
698  if (!decl2) {
699  cr_declaration_destroy (decl);
701  ("Could not append decl to ruleset");
702  goto error;
703  }
704  ctxt->cur_stmt->kind.font_face_rule->decl_list = decl2;
705  decl = NULL;
706  decl2 = NULL;
707  break;
708  case AT_PAGE_RULE_STMT:
709  decl2 = cr_declaration_append
710  (ctxt->cur_stmt->kind.page_rule->decl_list, decl);
711  if (!decl2) {
712  cr_declaration_destroy (decl);
714  ("Could not append decl to ruleset");
715  goto error;
716  }
717  ctxt->cur_stmt->kind.page_rule->decl_list = decl2;
718  decl = NULL;
719  decl2 = NULL;
720  break;
721 
722  default:
723  goto error;
724  break;
725  }
726 
727  return;
728 
729  error:
730  if (str) {
731  g_free (str);
732  str = NULL;
733  }
734 
735  if (decl) {
736  cr_declaration_destroy (decl);
737  decl = NULL;
738  }
739 }
740 
741 static void
742 error (CRDocHandler * a_this)
743 {
744  enum CRStatus status = CR_OK;
745  ParsingContext *ctxt = NULL;
746  ParsingContext **ctxtptr = NULL;
747 
748  g_return_if_fail (a_this);
749  ctxtptr = &ctxt;
750  status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
751  g_return_if_fail (status == CR_OK && ctxt);
752 
753  if (ctxt->cur_stmt) {
755  ctxt->cur_stmt = NULL;
756  }
757 }
758 
759 static void
760 unrecoverable_error (CRDocHandler * a_this)
761 {
762  enum CRStatus status = CR_OK;
763  ParsingContext *ctxt = NULL;
764  ParsingContext **ctxtptr = NULL;
765 
766  ctxtptr = &ctxt;
767  status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
768  g_return_if_fail (status == CR_OK);
769 
770  if (ctxt) {
771  if (ctxt->stylesheet) {
773  (a_this, ctxt->stylesheet);
774  g_return_if_fail (status == CR_OK);
775  }
776  g_free (ctxt);
777  cr_doc_handler_set_ctxt (a_this, NULL);
778  }
779 }
780 
781 /********************************************
782  *Public methods
783  ********************************************/
784 
785 /**
786  * cr_om_parser_new:
787  *@a_input: the input stream.
788  *
789  *Constructor of the CROMParser.
790  *Returns the newly built instance of #CROMParser.
791  */
792 CROMParser *
794 {
795  CROMParser *result = NULL;
796  enum CRStatus status = CR_OK;
797 
798  result = g_try_malloc (sizeof (CROMParser));
799 
800  if (!result) {
801  cr_utils_trace_info ("Out of memory");
802  return NULL;
803  }
804 
805  memset (result, 0, sizeof (CROMParser));
806  PRIVATE (result) = g_try_malloc (sizeof (CROMParserPriv));
807 
808  if (!PRIVATE (result)) {
809  cr_utils_trace_info ("Out of memory");
810  goto error;
811  }
812 
813  memset (PRIVATE (result), 0, sizeof (CROMParserPriv));
814 
815  PRIVATE (result)->parser = cr_parser_new_from_input (a_input);
816 
817  if (!PRIVATE (result)->parser) {
818  cr_utils_trace_info ("parsing instantiation failed");
819  goto error;
820  }
821 
822  status = cr_om_parser_init_default_sac_handler (result);
823 
824  if (status != CR_OK) {
825  goto error;
826  }
827 
828  return result;
829 
830  error:
831 
832  if (result) {
833  cr_om_parser_destroy (result);
834  }
835 
836  return NULL;
837 }
838 
839 /**
840  * cr_om_parser_parse_buf:
841  *@a_this: the current instance of #CROMParser.
842  *@a_buf: the in memory buffer to parse.
843  *@a_len: the length of the in memory buffer in number of bytes.
844  *@a_enc: the encoding of the in memory buffer.
845  *@a_result: out parameter the resulting style sheet
846  *
847  *Parses the content of an in memory buffer.
848  *
849  *Returns CR_OK upon successfull completion, an error code otherwise.
850  */
851 enum CRStatus
853  const guchar * a_buf,
854  gulong a_len,
855  enum CREncoding a_enc, CRStyleSheet ** a_result)
856 {
857 
858  enum CRStatus status = CR_OK;
859 
860  g_return_val_if_fail (a_this && a_result, CR_BAD_PARAM_ERROR);
861 
862  if (!PRIVATE (a_this)->parser) {
863  PRIVATE (a_this)->parser = cr_parser_new (NULL);
864  }
865 
866  status = cr_parser_parse_buf (PRIVATE (a_this)->parser,
867  a_buf, a_len, a_enc);
868 
869  if (status == CR_OK) {
870  CRStyleSheet *result = NULL;
871  CRStyleSheet **resultptr = NULL;
872  CRDocHandler *sac_handler = NULL;
873 
874  cr_parser_get_sac_handler (PRIVATE (a_this)->parser,
875  &sac_handler);
876  g_return_val_if_fail (sac_handler, CR_ERROR);
877  resultptr = &result;
878  status = cr_doc_handler_get_result (sac_handler,
879  (gpointer *) resultptr);
880  g_return_val_if_fail (status == CR_OK, status);
881 
882  if (result)
883  *a_result = result;
884  }
885 
886  return status;
887 }
888 
889 /**
890  * cr_om_parser_simply_parse_buf:
891  *@a_buf: the css2 in memory buffer.
892  *@a_len: the length of the in memory buffer.
893  *@a_enc: the encoding of the in memory buffer.
894  *@a_result: out parameter. The resulting css2 style sheet.
895  *
896  *The simpler way to parse an in memory css2 buffer.
897  *
898  *Returns CR_OK upon successfull completion, an error code otherwise.
899  */
900 enum CRStatus
901 cr_om_parser_simply_parse_buf (const guchar * a_buf,
902  gulong a_len,
903  enum CREncoding a_enc,
904  CRStyleSheet ** a_result)
905 {
906  CROMParser *parser = NULL;
907  enum CRStatus status = CR_OK;
908 
909  parser = cr_om_parser_new (NULL);
910  if (!parser) {
911  cr_utils_trace_info ("Could not create om parser");
912  cr_utils_trace_info ("System possibly out of memory");
913  return CR_ERROR;
914  }
915 
916  status = cr_om_parser_parse_buf (parser, a_buf, a_len,
917  a_enc, a_result);
918 
919  if (parser) {
920  cr_om_parser_destroy (parser);
921  parser = NULL;
922  }
923 
924  return status;
925 }
926 
927 /**
928  * cr_om_parser_parse_file:
929  *@a_this: the current instance of the cssom parser.
930  *@a_file_uri: the uri of the file.
931  *(only local file paths are suppported so far)
932  *@a_enc: the encoding of the file.
933  *@a_result: out parameter. A pointer
934  *the build css object model.
935  *
936  *Parses a css2 stylesheet contained
937  *in a file.
938  *
939  * Returns CR_OK upon succesful completion, an error code otherwise.
940  */
941 enum CRStatus
943  const guchar * a_file_uri,
944  enum CREncoding a_enc, CRStyleSheet ** a_result)
945 {
946  enum CRStatus status = CR_OK;
947 
948  g_return_val_if_fail (a_this && a_file_uri && a_result,
950 
951  if (!PRIVATE (a_this)->parser) {
952  PRIVATE (a_this)->parser = cr_parser_new_from_file
953  (a_file_uri, a_enc);
954  }
955 
956  status = cr_parser_parse_file (PRIVATE (a_this)->parser,
957  a_file_uri, a_enc);
958 
959  if (status == CR_OK) {
960  CRStyleSheet *result = NULL;
961  CRStyleSheet **resultptr = NULL;
962  CRDocHandler *sac_handler = NULL;
963 
964  cr_parser_get_sac_handler (PRIVATE (a_this)->parser,
965  &sac_handler);
966  g_return_val_if_fail (sac_handler, CR_ERROR);
967  resultptr = &result;
969  (sac_handler, (gpointer *) resultptr);
970  g_return_val_if_fail (status == CR_OK, status);
971  if (result)
972  *a_result = result;
973  }
974 
975  return status;
976 }
977 
978 /**
979  * cr_om_parser_simply_parse_file:
980  *@a_file_path: the css2 local file path.
981  *@a_enc: the file encoding.
982  *@a_result: out parameter. The returned css stylesheet.
983  *Must be freed by the caller using cr_stylesheet_destroy.
984  *
985  *The simpler method to parse a css2 file.
986  *
987  *Returns CR_OK upon successfull completion, an error code otherwise.
988  *Note that this method uses cr_om_parser_parse_file() so both methods
989  *have the same return values.
990  */
991 enum CRStatus
992 cr_om_parser_simply_parse_file (const guchar * a_file_path,
993  enum CREncoding a_enc,
994  CRStyleSheet ** a_result)
995 {
996  CROMParser *parser = NULL;
997  enum CRStatus status = CR_OK;
998 
999  parser = cr_om_parser_new (NULL);
1000  if (!parser) {
1001  cr_utils_trace_info ("Could not allocate om parser");
1002  cr_utils_trace_info ("System may be out of memory");
1003  return CR_ERROR;
1004  }
1005 
1006  status = cr_om_parser_parse_file (parser, a_file_path,
1007  a_enc, a_result);
1008  if (parser) {
1009  cr_om_parser_destroy (parser);
1010  parser = NULL;
1011  }
1012 
1013  return status;
1014 }
1015 
1016 /**
1017  * cr_om_parser_parse_paths_to_cascade:
1018  *@a_this: the current instance of #CROMParser
1019  *@a_author_path: the path to the author stylesheet
1020  *@a_user_path: the path to the user stylesheet
1021  *@a_ua_path: the path to the User Agent stylesheet
1022  *@a_encoding: the encoding of the sheets.
1023  *@a_result: out parameter. The resulting cascade if the parsing
1024  *was okay
1025  *
1026  *Parses three sheets located by their paths and build a cascade
1027  *
1028  *Returns CR_OK upon successful completion, an error code otherwise
1029  */
1030 enum CRStatus
1032  const guchar * a_author_path,
1033  const guchar * a_user_path,
1034  const guchar * a_ua_path,
1035  enum CREncoding a_encoding,
1036  CRCascade ** a_result)
1037 {
1038  enum CRStatus status = CR_OK;
1039 
1040  /*0->author sheet, 1->user sheet, 2->UA sheet */
1041  CRStyleSheet *sheets[3];
1042  guchar *paths[3];
1043  CRCascade *result = NULL;
1044  gint i = 0;
1045 
1046  g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR);
1047 
1048  memset (sheets, 0, sizeof (CRStyleSheet*) * 3);
1049  paths[0] = (guchar *) a_author_path;
1050  paths[1] = (guchar *) a_user_path;
1051  paths[2] = (guchar *) a_ua_path;
1052 
1053  for (i = 0; i < 3; i++) {
1054  status = cr_om_parser_parse_file (a_this, paths[i],
1055  a_encoding, &sheets[i]);
1056  if (status != CR_OK) {
1057  if (sheets[i]) {
1058  cr_stylesheet_unref (sheets[i]);
1059  sheets[i] = NULL;
1060  }
1061  continue;
1062  }
1063  }
1064  result = cr_cascade_new (sheets[0], sheets[1], sheets[2]);
1065  if (!result) {
1066  for (i = 0; i < 3; i++) {
1067  cr_stylesheet_unref (sheets[i]);
1068  sheets[i] = 0;
1069  }
1070  return CR_ERROR;
1071  }
1072  *a_result = result;
1073  return CR_OK;
1074 }
1075 
1076 /**
1077  * cr_om_parser_simply_parse_paths_to_cascade:
1078  *@a_author_path: the path to the author stylesheet
1079  *@a_user_path: the path to the user stylesheet
1080  *@a_ua_path: the path to the User Agent stylesheet
1081  *@a_encoding: the encoding of the sheets.
1082  *@a_result: out parameter. The resulting cascade if the parsing
1083  *was okay
1084  *
1085  *Parses three sheets located by their paths and build a cascade
1086  *
1087  *Returns CR_OK upon successful completion, an error code otherwise
1088  */
1089 enum CRStatus
1090 cr_om_parser_simply_parse_paths_to_cascade (const guchar * a_author_path,
1091  const guchar * a_user_path,
1092  const guchar * a_ua_path,
1093  enum CREncoding a_encoding,
1094  CRCascade ** a_result)
1095 {
1096  enum CRStatus status = CR_OK;
1097  CROMParser *parser = NULL;
1098 
1099  parser = cr_om_parser_new (NULL);
1100  if (!parser) {
1101  cr_utils_trace_info ("could not allocated om parser");
1102  cr_utils_trace_info ("System may be out of memory");
1103  return CR_ERROR;
1104  }
1105  status = cr_om_parser_parse_paths_to_cascade (parser,
1106  a_author_path,
1107  a_user_path,
1108  a_ua_path,
1109  a_encoding, a_result);
1110  if (parser) {
1111  cr_om_parser_destroy (parser);
1112  parser = NULL;
1113  }
1114  return status;
1115 }
1116 
1117 /**
1118  * cr_om_parser_destroy:
1119  *@a_this: the current instance of #CROMParser.
1120  *
1121  *Destructor of the #CROMParser.
1122  */
1123 void
1125 {
1126  g_return_if_fail (a_this && PRIVATE (a_this));
1127 
1128  if (PRIVATE (a_this)->parser) {
1129  cr_parser_destroy (PRIVATE (a_this)->parser);
1130  PRIVATE (a_this)->parser = NULL;
1131  }
1132 
1133  if (PRIVATE (a_this)) {
1134  g_free (PRIVATE (a_this));
1135  PRIVATE (a_this) = NULL;
1136  }
1137 
1138  if (a_this) {
1139  g_free (a_this);
1140  a_this = NULL;
1141  }
1142 }
cr_parser_parse_buf
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 ...
Definition: cr-parser.c:4467
cr_parser_new_from_file
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.
Definition: cr-parser.c:2837
_ParsingContext
Definition: cr-om-parser.c:101
_CRStatement::ruleset
CRRuleSet * ruleset
Definition: cr-statement.h:191
AT_PAGE_RULE_STMT
@ AT_PAGE_RULE_STMT
A css2 page rule.
Definition: cr-statement.h:165
_CRStyleSheet
An abstraction of a css stylesheet as defined by the css2 spec in chapter 4.
Definition: cr-stylesheet.h:57
_CRStatement::kind
union _CRStatement::@1 kind
cr_declaration_destroy
void cr_declaration_destroy(CRDeclaration *a_this)
cr_declaration_destroy: @a_this: the current instance of CRDeclaration.
Definition: cr-declaration.c:769
_CRParser
The implementation of the SAC parser.
Definition: cr-parser.h:51
cr_parser_parse_file
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.
Definition: cr-parser.c:2977
cr_statement_new_at_charset_rule
CRStatement * cr_statement_new_at_charset_rule(CRStyleSheet *a_sheet, CRString *a_charset)
cr_statement_new_at_charset_rule:
Definition: cr-statement.c:1571
_CRStatement::page_rule
CRAtPageRule * page_rule
Definition: cr-statement.h:194
cr_om_parser_simply_parse_buf
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.
Definition: cr-om-parser.c:901
_ParsingContext::cur_media_stmt
CRStatement * cur_media_stmt
Definition: cr-om-parser.c:104
_CRStatement::type
enum CRStatementType type
The type of the statement.
Definition: cr-statement.h:187
CR_BAD_PARAM_ERROR
@ CR_BAD_PARAM_ERROR
Definition: cr-utils.h:45
_CRRuleSet::decl_list
CRDeclaration * decl_list
A list of instances of CRDeclaration.
Definition: cr-statement.h:69
_CRDeclaration
Definition: cr-declaration.h:47
cr_statement_new_at_page_rule
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:
Definition: cr-statement.c:1447
cr_statement_new_at_font_face_rule
CRStatement * cr_statement_new_at_font_face_rule(CRStyleSheet *a_sheet, CRDeclaration *a_font_decls)
cr_statement_new_at_font_face_rule:
Definition: cr-statement.c:1667
CRString
typedefG_BEGIN_DECLS struct _CRString CRString
Definition: cr-string.h:37
_ParsingContext::cur_stmt
CRStatement * cur_stmt
Definition: cr-om-parser.c:103
CRDocHandler
typedefG_BEGIN_DECLS struct _CRDocHandler CRDocHandler
Definition: cr-doc-handler.h:40
cr_doc_handler_set_result
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.
Definition: cr-doc-handler.c:161
cr_parser_new_from_input
CRParser * cr_parser_new_from_input(CRInput *a_input)
cr_parser_new_from_input: @a_input: the parser input stream to use.
Definition: cr-parser.c:2813
cr_declaration_append
CRDeclaration * cr_declaration_append(CRDeclaration *a_this, CRDeclaration *a_new)
cr_declaration_append: @a_this: the current declaration list.
Definition: cr-declaration.c:294
cr_om_parser_parse_file
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.
Definition: cr-om-parser.c:942
cr_statement_new_at_import_rule
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:
Definition: cr-statement.c:1323
_CRAtFontFaceRule::decl_list
CRDeclaration * decl_list
Definition: cr-statement.h:137
_CRStatement::font_face_rule
CRAtFontFaceRule * font_face_rule
Definition: cr-statement.h:196
cr_om_parser_simply_parse_file
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.
Definition: cr-om-parser.c:992
_CRStatement::media_rule
CRAtMediaRule * media_rule
Definition: cr-statement.h:193
cr_string_destroy
void cr_string_destroy(CRString *a_this)
Definition: cr-string.c:159
cr_doc_handler_set_ctxt
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...
Definition: cr-doc-handler.c:123
cr_doc_handler_get_ctxt
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.
Definition: cr-doc-handler.c:104
CR_OK
@ CR_OK
Definition: cr-utils.h:44
cr-om-parser.h
cr_stylesheet_destroy
void cr_stylesheet_destroy(CRStyleSheet *a_this)
Destructor of the CRStyleSheet class.
Definition: cr-stylesheet.c:169
_ParsingContext::stylesheet
CRStyleSheet * stylesheet
Definition: cr-om-parser.c:102
_CRInput
The CRInput class provides the abstraction of an utf8-encoded character stream.
Definition: cr-input.h:47
cr_cascade_new
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.
Definition: cr-cascade.c:64
RULESET_STMT
@ RULESET_STMT
Definition: cr-statement.h:156
_CRAtMediaRule
abstraction of an @media rule
Definition: cr-statement.h:106
cr_string_dup
CRString * cr_string_dup(CRString const *a_this)
Definition: cr-string.c:94
_CRStatement
The abstraction of css statement as defined in the chapter 4 and appendix D.1 of the css2 spec.
Definition: cr-statement.h:182
cr_om_parser_destroy
void cr_om_parser_destroy(CROMParser *a_this)
cr_om_parser_destroy: @a_this: the current instance of CROMParser.
Definition: cr-om-parser.c:1124
_CRParsingLocation
Definition: cr-parsing-location.h:39
cr_om_parser_new
CROMParser * cr_om_parser_new(CRInput *a_input)
cr_om_parser_new: @a_input: the input stream.
Definition: cr-om-parser.c:793
_CRAtPageRule::pseudo
CRString * pseudo
Definition: cr-statement.h:122
_CRAtPageRule::name
CRString * name
page selector.
Definition: cr-statement.h:121
cr_statement_new_ruleset
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:
Definition: cr-statement.c:1119
AT_MEDIA_RULE_STMT
@ AT_MEDIA_RULE_STMT
A css2 media rule.
Definition: cr-statement.h:162
_CRCascade
Definition: cr-cascade.h:49
cr_stylesheet_unref
gboolean cr_stylesheet_unref(CRStyleSheet *a_this)
Definition: cr-stylesheet.c:149
_CRDeclaration::important
gboolean important
Definition: cr-declaration.h:65
cr_statement_new_at_media_rule
CRStatement * cr_statement_new_at_media_rule(CRStyleSheet *a_sheet, CRStatement *a_rulesets, GList *a_media)
cr_statement_new_at_media_rule:
Definition: cr-statement.c:1262
CR_ERROR
@ CR_ERROR
Definition: cr-utils.h:66
_CROMParserPriv
@CROMParser:
Definition: cr-om-parser.c:36
cr_declaration_new
CRDeclaration * cr_declaration_new(CRStatement *a_statement, CRString *a_property, CRTerm *a_value)
cr_declaration_new: @a_statement: the statement this declaration belongs to.
Definition: cr-declaration.c:74
PRIVATE
#define PRIVATE(a_this)
Definition: cr-om-parser.c:40
AT_FONT_FACE_RULE_STMT
@ AT_FONT_FACE_RULE_STMT
A css2 font face rule.
Definition: cr-statement.h:171
CREncoding
CREncoding
Encoding values.
Definition: cr-utils.h:84
cr_om_parser_simply_parse_paths_to_cascade
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...
Definition: cr-om-parser.c:1090
cr_utils_dup_glist_of_cr_string
GList * cr_utils_dup_glist_of_cr_string(GList const *a_list_of_strings)
Duplicate a GList where the GList::data is a CRString.
Definition: cr-utils.c:1314
cr_parser_get_sac_handler
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.
Definition: cr-parser.c:2889
cr_statement_append
CRStatement * cr_statement_append(CRStatement *a_this, CRStatement *a_new)
cr_statement_append:
Definition: cr-statement.c:1821
cr_doc_handler_get_result
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.
Definition: cr-doc-handler.c:141
_CRTerm
An abstraction of a css2 term as defined in the CSS2 spec in appendix D.1: term ::= [ NUMBER S* | PER...
Definition: cr-term.h:82
_CRAtMediaRule::rulesets
CRStatement * rulesets
Definition: cr-statement.h:109
CRStatus
CRStatus
The status type returned by the methods of the croco library.
Definition: cr-utils.h:43
cr_om_parser_parse_buf
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.
Definition: cr-om-parser.c:852
cr_parser_set_sac_handler
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.
Definition: cr-parser.c:2863
CRSelector
typedefG_BEGIN_DECLS struct _CRSelector CRSelector
Definition: cr-selector.h:40
cr-utils.h
cr_parser_new
CRParser * cr_parser_new(CRTknzr *a_tknzr)
cr_parser_new: @a_tknzr: the tokenizer to use for the parsing.
Definition: cr-parser.c:2751
_CRStyleSheet::statements
CRStatement * statements
The css statements list.
Definition: cr-stylesheet.h:60
_CRAtPageRule::decl_list
CRDeclaration * decl_list
a list of instances of CRDeclaration
Definition: cr-statement.h:118
cr_parser_destroy
void cr_parser_destroy(CRParser *a_this)
cr_parser_destroy: @a_this: the current instance of CRParser to destroy.
Definition: cr-parser.c:4498
cr_statement_destroy
void cr_statement_destroy(CRStatement *a_this)
cr_statement_destroy:
Definition: cr-statement.c:2756
cr_doc_handler_unref
gboolean cr_doc_handler_unref(CRDocHandler *a_this)
cr_doc_handler_unref: @a_this: the currrent instance of CRDocHandler.
Definition: cr-doc-handler.c:227
cr_om_parser_parse_paths_to_cascade
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 ...
Definition: cr-om-parser.c:1031
_CROMParserPriv::parser
CRParser * parser
Definition: cr-om-parser.c:37
cr_utils_trace_info
#define cr_utils_trace_info(a_msg)
Traces an info message.
Definition: cr-utils.h:127
CROMParser
typedefG_BEGIN_DECLS struct _CROMParser CROMParser
Definition: cr-om-parser.h:44
cr_doc_handler_new
CRDocHandler * cr_doc_handler_new(void)
cr_doc_handler_new: Constructor of CRDocHandler.
Definition: cr-doc-handler.c:70
cr_stylesheet_new
CRStyleSheet * cr_stylesheet_new(CRStatement *a_stmts)
Constructor of the CRStyleSheet class.
Definition: cr-stylesheet.c:37