This fixes a couple of warnings.
Reported by Frank Hunleth <fhunleth@troodon-software.com>
at <https://savannah.gnu.org/bugs/?55356>.
* libtextstyle/gnulib-local/lib/libcroco/*: Upgrade to version 0.6.13.
* libtextstyle/gnulib-local/modules/libcroco: Update.
* libtextstyle/gnulib-local/lib/glib/gmacros.in.h: New file, based on
glib-2.12.4/glib/gmacros.h.
* libtextstyle/gnulib-local/lib/glib/gprintfint.in.h: New file, based on
glib-2.12.4/glib/gprintfint.h.
* libtextstyle/Makefile.am (EXTRA_DIST): Add them.
* libtextstyle/gnulib-local/m4/libglib.m4 (gl_LIBGLIB): Add glib/gmacros.h and
glib/gprintfint.h to LIBGLIB_H.
* libtextstyle/gnulib-local/modules/libglib (Files): Add lib/glib/gmacros.in.h,
lib/glib/gprintfint.in.h.
(Depends-on): Add snprintf-posix.
(glib/gmacros.h, glib/gprintfint.h): New rules.
(MOSTLYCLEANFILES): Add glib/gmacros.h, glib/gprintfint.h.
* libtextstyle/gnulib-local/lib/glib.in.h: Include glib/gmacros.h.
* libtextstyle/gnulib-local/lib/glib/gstrfuncs.in.h (g_ascii_dtostr,
g_ascii_formatd, g_ascii_strcasecmp): Enable declarations.
* libtextstyle/gnulib-local/lib/glib/gstrfuncs.c: Include gprintfint.h.
(g_ascii_dtostr, g_ascii_formatd): Enable.
(ISSPACE, ISUPPER, ISLOWER, ISALPHA, TOUPPER, TOLOWER): Move out of function
g_parse_long_long.
(g_ascii_strcasecmp): Enable.
/lib/float+.h
/lib/float.c
/lib/float.in.h
+/lib/fpucw.h
+/lib/frexp.c
+/lib/frexpl.c
/lib/fstat.c
/lib/fsync.c
/lib/full-write.c
/lib/pathmax.h
/lib/printf-args.c
/lib/printf-args.h
+/lib/printf-frexp.c
+/lib/printf-frexp.h
+/lib/printf-frexpl.c
+/lib/printf-frexpl.h
/lib/printf-parse.c
/lib/printf-parse.h
/lib/raise.c
/lib/float.h-t
/lib/glib/ghash.h
/lib/glib/glist.h
+/lib/glib/gmacros.h
/lib/glib/gprimes.h
+/lib/glib/gprintfint.h
/lib/glib/gstrfuncs.h
/lib/glib/gstring.h
/lib/glib/gtypes.h
gnulib-local/lib/glib/ghash.in.h \
gnulib-local/lib/glib/glist.c \
gnulib-local/lib/glib/glist.in.h \
+ gnulib-local/lib/glib/gmacros.in.h \
gnulib-local/lib/glib/gmessages.c \
gnulib-local/lib/glib/gprimes.c \
gnulib-local/lib/glib/gprimes.in.h \
+ gnulib-local/lib/glib/gprintfint.in.h \
gnulib-local/lib/glib/gstrfuncs.c \
gnulib-local/lib/glib/gstrfuncs.in.h \
gnulib-local/lib/glib/gstring.c \
#include <glib/gkeyfile.h>
#endif
#include <glib/glist.h>
-#if 0
#include <glib/gmacros.h>
+#if 0
#include <glib/gmain.h>
#include <glib/gmappedfile.h>
#include <glib/gmarkup.h>
--- /dev/null
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+/*
+ * Modified by Bruno Haible for use as a gnulib module.
+ */
+
+/* This file must not include any other glib header file and must thus
+ * not refer to variables from glibconfig.h
+ */
+
+#ifndef __G_MACROS_H__
+#define __G_MACROS_H__
+
+/* We include stddef.h to get the system's definition of NULL
+ */
+#include <stddef.h>
+
+/* Get LONG_MAX.
+ */
+#include <limits.h>
+
+#if 0
+
+/* Here we provide G_GNUC_EXTENSION as an alias for __extension__,
+ * where this is valid. This allows for warningless compilation of
+ * "long long" types even in the presence of '-ansi -pedantic'.
+ */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
+# define G_GNUC_EXTENSION __extension__
+#else
+# define G_GNUC_EXTENSION
+#endif
+
+/* Provide macros to feature the GCC function attribute.
+ */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+#define G_GNUC_PURE \
+ __attribute__((__pure__))
+#define G_GNUC_MALLOC \
+ __attribute__((__malloc__))
+#else
+#define G_GNUC_PURE
+#define G_GNUC_MALLOC
+#endif
+
+#if __GNUC__ >= 4
+#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
+#else
+#define G_GNUC_NULL_TERMINATED
+#endif
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+#define G_GNUC_PRINTF( format_idx, arg_idx ) \
+ __attribute__((__format__ (__printf__, format_idx, arg_idx)))
+#define G_GNUC_SCANF( format_idx, arg_idx ) \
+ __attribute__((__format__ (__scanf__, format_idx, arg_idx)))
+#define G_GNUC_FORMAT( arg_idx ) \
+ __attribute__((__format_arg__ (arg_idx)))
+#define G_GNUC_NORETURN \
+ __attribute__((__noreturn__))
+#define G_GNUC_CONST \
+ __attribute__((__const__))
+#define G_GNUC_UNUSED \
+ __attribute__((__unused__))
+#define G_GNUC_NO_INSTRUMENT \
+ __attribute__((__no_instrument_function__))
+#else /* !__GNUC__ */
+#define G_GNUC_PRINTF( format_idx, arg_idx )
+#define G_GNUC_SCANF( format_idx, arg_idx )
+#define G_GNUC_FORMAT( arg_idx )
+#define G_GNUC_NORETURN
+#define G_GNUC_CONST
+#define G_GNUC_UNUSED
+#define G_GNUC_NO_INSTRUMENT
+#endif /* !__GNUC__ */
+
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
+#define G_GNUC_DEPRECATED \
+ __attribute__((__deprecated__))
+#else
+#define G_GNUC_DEPRECATED
+#endif /* __GNUC__ */
+
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#define G_GNUC_WARN_UNUSED_RESULT \
+ __attribute__((warn_unused_result))
+#else
+#define G_GNUC_WARN_UNUSED_RESULT
+#endif /* __GNUC__ */
+
+/* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with
+ * macros, so we can refer to them as strings unconditionally.
+ * usage not-recommended since gcc-3.0
+ */
+#if defined (__GNUC__) && (__GNUC__ < 3)
+#define G_GNUC_FUNCTION __FUNCTION__
+#define G_GNUC_PRETTY_FUNCTION __PRETTY_FUNCTION__
+#else /* !__GNUC__ */
+#define G_GNUC_FUNCTION ""
+#define G_GNUC_PRETTY_FUNCTION ""
+#endif /* !__GNUC__ */
+
+#define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string)
+#define G_STRINGIFY_ARG(contents) #contents
+
+/* Provide a string identifying the current code position */
+#if defined(__GNUC__) && (__GNUC__ < 3) && !defined(__cplusplus)
+# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()"
+#else
+# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__)
+#endif
+
+/* Provide a string identifying the current function, non-concatenatable */
+#if defined (__GNUC__)
+# define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__))
+#elif defined (G_HAVE_ISO_VARARGS)
+# define G_STRFUNC ((const char*) (__func__))
+#else
+# define G_STRFUNC ((const char*) ("???"))
+#endif
+
+/* Guard C code in headers, while including them from C++ */
+#ifdef __cplusplus
+# define G_BEGIN_DECLS extern "C" {
+# define G_END_DECLS }
+#else
+# define G_BEGIN_DECLS
+# define G_END_DECLS
+#endif
+
+/* Provide definitions for some commonly used macros.
+ * Some of them are only provided if they haven't already
+ * been defined. It is assumed that if they are already
+ * defined then the current definition is correct.
+ */
+#ifndef NULL
+# ifdef __cplusplus
+# define NULL (0L)
+# else /* !__cplusplus */
+# define NULL ((void*) 0)
+# endif /* !__cplusplus */
+#endif
+
+#ifndef FALSE
+#define FALSE (0)
+#endif
+
+#ifndef TRUE
+#define TRUE (!FALSE)
+#endif
+
+#undef MAX
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+
+#undef MIN
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+
+#undef ABS
+#define ABS(a) (((a) < 0) ? -(a) : (a))
+
+#undef CLAMP
+#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
+
+#endif
+
+/* Count the number of elements in an array. The array must be defined
+ * as such; using this with a dynamically allocated array will give
+ * incorrect results.
+ */
+#define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0]))
+
+#if 0
+
+/* Macros by analogy to GINT_TO_POINTER, GPOINTER_TO_INT
+ */
+#define GPOINTER_TO_SIZE(p) ((gsize) (p))
+#define GSIZE_TO_POINTER(s) ((gpointer) (gsize) (s))
+
+/* Provide convenience macros for handling structure
+ * fields through their offsets.
+ */
+#define G_STRUCT_OFFSET(struct_type, member) \
+ ((glong) ((guint8*) &((struct_type*) 0)->member))
+#define G_STRUCT_MEMBER_P(struct_p, struct_offset) \
+ ((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset)))
+#define G_STRUCT_MEMBER(member_type, struct_p, struct_offset) \
+ (*(member_type*) G_STRUCT_MEMBER_P ((struct_p), (struct_offset)))
+
+/* Provide simple macro statement wrappers (adapted from Perl):
+ * G_STMT_START { statements; } G_STMT_END;
+ * can be used as a single statement, as in
+ * if (x) G_STMT_START { ... } G_STMT_END; else ...
+ *
+ * When GCC is compiling C code in non-ANSI mode, it will use the
+ * compiler __extension__ to wrap the statements wihin `({' and '})' braces.
+ * When compiling on platforms where configure has defined
+ * HAVE_DOWHILE_MACROS, statements will be wrapped with `do' and `while (0)'.
+ * For any other platforms (SunOS4 is known to have this issue), wrap the
+ * statements with `if (1)' and `else (void) 0'.
+ */
+#if !(defined (G_STMT_START) && defined (G_STMT_END))
+# if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus)
+# define G_STMT_START (void) __extension__ (
+# define G_STMT_END )
+# else /* !(__GNUC__ && !__STRICT_ANSI__ && !__cplusplus) */
+# if defined (HAVE_DOWHILE_MACROS)
+# define G_STMT_START do
+# define G_STMT_END while (0)
+# else /* !HAVE_DOWHILE_MACROS */
+# define G_STMT_START if (1)
+# define G_STMT_END else (void) 0
+# endif /* !HAVE_DOWHILE_MACROS */
+# endif /* !(__GNUC__ && !__STRICT_ANSI__ && !__cplusplus) */
+#endif
+
+/* Allow the app programmer to select whether or not return values
+ * (usually char*) are const or not. Don't try using this feature for
+ * functions with C++ linkage.
+ */
+#ifdef G_DISABLE_CONST_RETURNS
+#define G_CONST_RETURN
+#else
+#define G_CONST_RETURN const
+#endif
+
+/*
+ * The G_LIKELY and G_UNLIKELY macros let the programmer give hints to
+ * the compiler about the expected result of an expression. Some compilers
+ * can use this information for optimizations.
+ *
+ * The _G_BOOLEAN_EXPR macro is intended to trigger a gcc warning when
+ * putting assignments in g_return_if_fail ().
+ */
+#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
+#define _G_BOOLEAN_EXPR(expr) \
+ __extension__ ({ \
+ int _g_boolean_var_; \
+ if (expr) \
+ _g_boolean_var_ = 1; \
+ else \
+ _g_boolean_var_ = 0; \
+ _g_boolean_var_; \
+})
+#define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1))
+#define G_UNLIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 0))
+#else
+#define G_LIKELY(expr) (expr)
+#define G_UNLIKELY(expr) (expr)
+#endif
+
+#endif
+
+/* Backport from glib-2.18.4.
+ */
+#define G_MAXLONG LONG_MAX
+
+#endif /* __G_MACROS_H__ */
--- /dev/null
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GLib Team and others 2002. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+/*
+ * Modified by Bruno Haible for use as a gnulib module.
+ */
+
+#ifndef __G_PRINTFINT_H__
+#define __G_PRINTFINT_H__
+
+#if 1
+
+#if 0
+#define _g_printf printf
+#define _g_fprintf fprintf
+#define _g_sprintf sprintf
+#endif
+#define _g_snprintf snprintf
+
+#if 0
+#define _g_vprintf vprintf
+#define _g_vfprintf vfprintf
+#define _g_vsprintf vsprintf
+#define _g_vsnprintf vsnprintf
+#endif
+
+#else
+
+#include "gnulib/printf.h"
+
+#define _g_printf _g_gnulib_printf
+#define _g_fprintf _g_gnulib_fprintf
+#define _g_sprintf _g_gnulib_sprintf
+#define _g_snprintf _g_gnulib_snprintf
+
+#define _g_vprintf _g_gnulib_vprintf
+#define _g_vfprintf _g_gnulib_vfprintf
+#define _g_vsprintf _g_gnulib_vsprintf
+#define _g_vsnprintf _g_gnulib_vsnprintf
+
+#endif
+
+#endif /* __G_PRINTF_H__ */
+
#include "glib.h"
#if 0
#include "gprintf.h"
+#endif
#include "gprintfint.h"
+#if 0
#include "galias.h"
#ifdef G_OS_WIN32
return val;
}
+#endif
/**
* g_ascii_dtostr:
return buffer;
}
+#define ISSPACE(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || \
+ (c) == '\r' || (c) == '\t' || (c) == '\v')
+#define ISUPPER(c) ((c) >= 'A' && (c) <= 'Z')
+#define ISLOWER(c) ((c) >= 'a' && (c) <= 'z')
+#define ISALPHA(c) (ISUPPER (c) || ISLOWER (c))
+#define TOUPPER(c) (ISLOWER (c) ? (c) - 'a' + 'A' : (c))
+#define TOLOWER(c) (ISUPPER (c) ? (c) - 'A' + 'a' : (c))
+
+#if 0
+
static guint64
g_parse_long_long (const gchar *nptr,
gchar **endptr,
*
* Copyright (C) 1991-1992, 1994-2002 Free Software Foundation, Inc.
*/
-#define ISSPACE(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || \
- (c) == '\r' || (c) == '\t' || (c) == '\v')
-#define ISUPPER(c) ((c) >= 'A' && (c) <= 'Z')
-#define ISLOWER(c) ((c) >= 'a' && (c) <= 'z')
-#define ISALPHA(c) (ISUPPER (c) || ISLOWER (c))
-#define TOUPPER(c) (ISLOWER (c) ? (c) - 'a' + 'A' : (c))
-#define TOLOWER(c) (ISUPPER (c) ? (c) - 'A' + 'a' : (c))
gboolean overflow;
guint64 cutoff;
guint64 cutlim;
return g_ascii_digit_value (c);
}
+#endif
+
/**
* g_ascii_strcasecmp:
* @s1: string to compare with @s2.
return (((gint)(guchar) *s1) - ((gint)(guchar) *s2));
}
+#if 0
+
/**
* g_ascii_strncasecmp:
* @s1: string to compare with @s2.
gint64 g_ascii_strtoll (const gchar *nptr,
gchar **endptr,
guint base);
+#endif
/* 29 bytes should enough for all possible values that
* g_ascii_dtostr can produce.
* Then add 10 for good measure */
const gchar *format,
gdouble d);
+#if 0
/* removes leading spaces */
gchar* g_strchug (gchar *string);
/* removes trailing spaces */
gchar* g_strchomp (gchar *string);
/* removes leading & trailing spaces */
#define g_strstrip( string ) g_strchomp (g_strchug (string))
+#endif
gint g_ascii_strcasecmp (const gchar *s1,
const gchar *s2);
+#if 0
gint g_ascii_strncasecmp (const gchar *s1,
const gchar *s2,
gsize n);
}
guchar *
-cr_additional_sel_to_string (CRAdditionalSel * a_this)
+cr_additional_sel_to_string (CRAdditionalSel const * a_this)
{
guchar *result = NULL;
GString *str_buf = NULL;
- CRAdditionalSel *cur = NULL;
+ CRAdditionalSel const *cur = NULL;
g_return_val_if_fail (a_this, NULL);
guchar *name = NULL;
if (cur->content.class_name) {
- name = g_strndup
+ name = (guchar *) g_strndup
(cur->content.class_name->stryng->str,
cur->content.class_name->stryng->len);
{
guchar *name = NULL;
- if (cur->content.class_name) {
- name = g_strndup
+ if (cur->content.id_name) {
+ name = (guchar *) g_strndup
(cur->content.id_name->stryng->str,
cur->content.id_name->stryng->len);
}
if (str_buf) {
- result = str_buf->str;
+ result = (guchar *) str_buf->str;
g_string_free (str_buf, FALSE);
str_buf = NULL;
}
}
guchar *
-cr_additional_sel_one_to_string (CRAdditionalSel *a_this)
+cr_additional_sel_one_to_string (CRAdditionalSel const *a_this)
{
guchar *result = NULL;
GString *str_buf = NULL;
guchar *name = NULL;
if (a_this->content.class_name) {
- name = g_strndup
+ name = (guchar *) g_strndup
(a_this->content.class_name->stryng->str,
a_this->content.class_name->stryng->len);
{
guchar *name = NULL;
- if (a_this->content.class_name) {
- name = g_strndup
+ if (a_this->content.id_name) {
+ name = (guchar *) g_strndup
(a_this->content.id_name->stryng->str,
a_this->content.id_name->stryng->len);
}
if (str_buf) {
- result = str_buf->str;
+ result = (guchar *) str_buf->str;
g_string_free (str_buf, FALSE);
str_buf = NULL;
}
* Dumps the current instance of #CRAdditionalSel to a file
*/
void
-cr_additional_sel_dump (CRAdditionalSel * a_this, FILE * a_fp)
+cr_additional_sel_dump (CRAdditionalSel const * a_this, FILE * a_fp)
{
guchar *tmp_str = NULL;
CRAdditionalSel * cr_additional_sel_prepend (CRAdditionalSel *a_this,
CRAdditionalSel *a_sel) ;
-guchar * cr_additional_sel_to_string (CRAdditionalSel *a_this) ;
+guchar * cr_additional_sel_to_string (CRAdditionalSel const *a_this) ;
-guchar * cr_additional_sel_one_to_string (CRAdditionalSel *a_this) ;
+guchar * cr_additional_sel_one_to_string (CRAdditionalSel const *a_this) ;
-void cr_additional_sel_dump (CRAdditionalSel *a_this, FILE *a_fp) ;
+void cr_additional_sel_dump (CRAdditionalSel const *a_this, FILE *a_fp) ;
void cr_additional_sel_destroy (CRAdditionalSel *a_this) ;
* Returns the serialized attribute selector.
*/
guchar *
-cr_attr_sel_to_string (CRAttrSel * a_this)
+cr_attr_sel_to_string (CRAttrSel const * a_this)
{
- CRAttrSel *cur = NULL;
+ CRAttrSel const *cur = NULL;
guchar *result = NULL;
GString *str_buf = NULL;
if (cur->name) {
guchar *name = NULL;
- name = g_strndup (cur->name->stryng->str,
+ name = (guchar *) g_strndup (cur->name->stryng->str,
cur->name->stryng->len);
if (name) {
- g_string_append (str_buf, name);
+ g_string_append (str_buf, (const gchar *) name);
g_free (name);
name = NULL;
}
if (cur->value) {
guchar *value = NULL;
- value = g_strndup (cur->value->stryng->str,
+ value = (guchar *) g_strndup (cur->value->stryng->str,
cur->value->stryng->len);
if (value) {
switch (cur->match_way) {
}
if (str_buf) {
- result = str_buf->str;
+ result = (guchar *) str_buf->str;
g_string_free (str_buf, FALSE);
}
* Dumps the current instance of #CRAttrSel to a file.
*/
void
-cr_attr_sel_dump (CRAttrSel * a_this, FILE * a_fp)
+cr_attr_sel_dump (CRAttrSel const * a_this, FILE * a_fp)
{
guchar *tmp_str = NULL;
enum CRStatus cr_attr_sel_prepend_attr_sel (CRAttrSel *a_this,
CRAttrSel *a_attr_sel) ;
-guchar * cr_attr_sel_to_string (CRAttrSel *a_this) ;
+guchar * cr_attr_sel_to_string (CRAttrSel const *a_this) ;
-void cr_attr_sel_dump (CRAttrSel *a_this, FILE *a_fp) ;
+void cr_attr_sel_dump (CRAttrSel const *a_this, FILE *a_fp) ;
void cr_attr_sel_destroy (CRAttrSel *a_this) ;
*/
/*
- *$Id: cr-cascade.c,v 1.7 2005/05/10 19:48:56 dodji Exp $
+ *$Id$
*/
#include <config.h>
PRIVATE (result) = g_try_malloc (sizeof (CRCascadePriv));
if (!PRIVATE (result)) {
cr_utils_trace_info ("Out of memory");
+ g_free (result);
return NULL;
}
memset (PRIVATE (result), 0, sizeof (CRCascadePriv));
*/
/*
- *$Id: cr-cascade.h,v 1.6 2004/01/29 22:05:14 dodji Exp $
+ *$Id$
*/
#ifndef __CR_CASCADE_H__
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
*Dumps (serializes) one css declaration to a file.
*/
static void
-dump (CRDeclaration * a_this, FILE * a_fp, glong a_indent)
+dump (CRDeclaration const * a_this, FILE * a_fp, glong a_indent)
{
guchar *str = NULL;
g_return_if_fail (a_this);
- str = cr_declaration_to_string (a_this, a_indent);
+ str = (guchar *) cr_declaration_to_string (a_this, a_indent);
if (str) {
fprintf (a_fp, "%s", str);
g_free (str);
*
*Returns the newly built instance of #CRDeclaration, or NULL in
*case of error.
+ *
+ *The returned CRDeclaration takes ownership of @a_property and @a_value.
+ *(E.g. cr_declaration_destroy on this CRDeclaration will also free
+ *@a_property and @a_value.)
*/
CRDeclaration *
cr_declaration_new (CRStatement * a_statement,
g_return_val_if_fail (a_statement->type == RULESET_STMT,
NULL);
- parser = cr_parser_new_from_buf ((guchar*)a_str, strlen (a_str), a_enc, FALSE);
+ parser = cr_parser_new_from_buf ((guchar*)a_str, strlen ((const char *) a_str), a_enc, FALSE);
g_return_val_if_fail (parser, NULL);
status = cr_parser_try_to_skip_spaces_and_comments (parser);
g_return_val_if_fail (a_str, NULL);
- parser = cr_parser_new_from_buf ((guchar*)a_str, strlen (a_str), a_enc, FALSE);
+ parser = cr_parser_new_from_buf ((guchar*)a_str, strlen ((const char *) a_str), a_enc, FALSE);
g_return_val_if_fail (parser, NULL);
status = cr_parser_get_tknzr (parser, &tokenizer);
if (status != CR_OK || !tokenizer) {
*Dumps a declaration list to a file.
*/
void
-cr_declaration_dump (CRDeclaration * a_this, FILE * a_fp, glong a_indent,
+cr_declaration_dump (CRDeclaration const * a_this, FILE * a_fp, glong a_indent,
gboolean a_one_per_line)
{
- CRDeclaration *cur = NULL;
+ CRDeclaration const *cur = NULL;
g_return_if_fail (a_this);
*Dumps the first declaration of the declaration list to a file.
*/
void
-cr_declaration_dump_one (CRDeclaration * a_this, FILE * a_fp, glong a_indent)
+cr_declaration_dump_one (CRDeclaration const * a_this, FILE * a_fp, glong a_indent)
{
g_return_if_fail (a_this);
*free the string using g_free().
*/
gchar *
-cr_declaration_to_string (CRDeclaration * a_this, gulong a_indent)
+cr_declaration_to_string (CRDeclaration const * a_this, gulong a_indent)
{
GString *stringue = NULL;
- guchar *str = NULL,
+ gchar *str = NULL,
*result = NULL;
g_return_val_if_fail (a_this, NULL);
*Serializes the declaration list into a string
*/
guchar *
-cr_declaration_list_to_string (CRDeclaration * a_this, gulong a_indent)
+cr_declaration_list_to_string (CRDeclaration const * a_this, gulong a_indent)
{
- CRDeclaration *cur = NULL;
+ CRDeclaration const *cur = NULL;
GString *stringue = NULL;
guchar *str = NULL,
*result = NULL;
stringue = g_string_new (NULL);
for (cur = a_this; cur; cur = cur->next) {
- str = cr_declaration_to_string (cur, a_indent);
+ str = (guchar *) cr_declaration_to_string (cur, a_indent);
if (str) {
g_string_append_printf (stringue, "%s;", str);
g_free (str);
break;
}
if (stringue && stringue->str) {
- result = stringue->str;
+ result = (guchar *) stringue->str;
g_string_free (stringue, FALSE);
}
* cr_declaration_list_to_string2:
*@a_this: the current instance of #CRDeclaration.
*@a_indent: the number of indentation white char
- @a_one_decl_per_line: whether to output one doc per line or not.
+ *@a_one_decl_per_line: whether to output one doc per line or not.
*to put before the actual serialisation.
*
*Serializes the declaration list into a string
*Returns the serialized form the declararation.
*/
guchar *
-cr_declaration_list_to_string2 (CRDeclaration * a_this,
+cr_declaration_list_to_string2 (CRDeclaration const * a_this,
gulong a_indent, gboolean a_one_decl_per_line)
{
- CRDeclaration *cur = NULL;
+ CRDeclaration const *cur = NULL;
GString *stringue = NULL;
guchar *str = NULL,
*result = NULL;
stringue = g_string_new (NULL);
for (cur = a_this; cur; cur = cur->next) {
- str = cr_declaration_to_string (cur, a_indent);
+ str = (guchar *) cr_declaration_to_string (cur, a_indent);
if (str) {
if (a_one_decl_per_line == TRUE) {
if (cur->next)
"%s;\n", str);
else
g_string_append (stringue,
- str);
+ (const gchar *) str);
} else {
if (cur->next)
g_string_append_printf (stringue,
"%s;", str);
else
g_string_append (stringue,
- str);
+ (const gchar *) str);
}
g_free (str);
} else
break;
}
if (stringue && stringue->str) {
- result = stringue->str;
+ result = (guchar *) stringue->str;
g_string_free (stringue, FALSE);
}
*Return the number of properties in the declaration
*/
gint
-cr_declaration_nr_props (CRDeclaration * a_this)
+cr_declaration_nr_props (CRDeclaration const * a_this)
{
- CRDeclaration *cur = NULL;
+ CRDeclaration const *cur = NULL;
int nr = 0;
g_return_val_if_fail (a_this, -1);
&& cur->property->stryng
&& cur->property->stryng->str) {
if (!strcmp (cur->property->stryng->str,
- a_prop)) {
+ (const char *) a_prop)) {
return cur;
}
}
/**
* cr_declaration_unref:
- *@param a_this the current instance of #CRDeclaration.
- *@return TRUE if the current instance of #CRDeclaration has been destroyed
- *(ref count reached zero), FALSE otherwise.
+ *@a_this: the current instance of #CRDeclaration.
*
*Decrements the ref count of the current instance of #CRDeclaration.
*If the ref count reaches zero, the current instance of #CRDeclaration
*if destroyed.
- *Returns TRUE if the object got destroyed, FALSE otherwise.
+ *Returns TRUE if @a_this was destroyed (ref count reached zero),
+ *FALSE otherwise.
*/
gboolean
cr_declaration_unref (CRDeclaration * a_this)
g_return_if_fail (a_this);
/*
- *Go get the tail of the list.
- *Meanwhile, free each property/value pair contained in the list.
+ * Go to the last element of the list.
*/
- for (cur = a_this; cur && cur->next; cur = cur->next) {
- if (cur->property) {
- cr_string_destroy (cur->property);
- cur->property = NULL;
- }
+ for (cur = a_this; cur->next; cur = cur->next)
+ g_assert (cur->next->prev == cur);
- if (cur->value) {
- cr_term_destroy (cur->value);
- cur->value = NULL;
- }
- }
+ /*
+ * Walk backward the list and free each "next" element.
+ * Meanwhile, free each property/value pair contained in the list.
+ */
+ for (; cur; cur = cur->prev) {
+ g_free (cur->next);
+ cur->next = NULL;
- if (cur) {
if (cur->property) {
cr_string_destroy (cur->property);
cur->property = NULL;
}
}
- /*in case the list contains only one element */
- if (cur && !cur->prev) {
- g_free (cur);
- return;
- }
-
- /*walk backward the list and free each "next" element */
- for (cur = cur->prev; cur && cur->prev; cur = cur->prev) {
- if (cur->next) {
- g_free (cur->next);
- cur->next = NULL;
- }
- }
-
- if (!cur)
- return;
-
- if (cur->next) {
- g_free (cur->next);
- cur->next = NULL;
- }
-
- g_free (cur);
+ g_free (a_this);
}
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
CRDeclaration * cr_declaration_unlink (CRDeclaration * a_decl) ;
void
-cr_declaration_dump (CRDeclaration *a_this,
+cr_declaration_dump (CRDeclaration const *a_this,
FILE *a_fp, glong a_indent,
gboolean a_one_per_line) ;
-void cr_declaration_dump_one (CRDeclaration *a_this,
+void cr_declaration_dump_one (CRDeclaration const *a_this,
FILE *a_fp, glong a_indent) ;
-gint cr_declaration_nr_props (CRDeclaration *a_this) ;
+gint cr_declaration_nr_props (CRDeclaration const *a_this) ;
CRDeclaration * cr_declaration_get_from_list (CRDeclaration *a_this,
int itemnr) ;
CRDeclaration * cr_declaration_get_by_prop_name (CRDeclaration *a_this,
const guchar *a_str) ;
-gchar * cr_declaration_to_string (CRDeclaration *a_this,
+gchar * cr_declaration_to_string (CRDeclaration const *a_this,
gulong a_indent) ;
-guchar * cr_declaration_list_to_string (CRDeclaration *a_this,
+guchar * cr_declaration_list_to_string (CRDeclaration const *a_this,
gulong a_indent) ;
-guchar * cr_declaration_list_to_string2 (CRDeclaration *a_this,
+guchar * cr_declaration_list_to_string2 (CRDeclaration const *a_this,
gulong a_indent,
gboolean a_one_decl_per_line) ;
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
g_return_val_if_fail (result, NULL);
memset (result, 0, sizeof (CRDocHandler));
+ result->ref_count++;
result->priv = g_try_malloc (sizeof (CRDocHandlerPriv));
if (!result->priv) {
*Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
-cr_doc_handler_get_ctxt (CRDocHandler * a_this, gpointer * a_ctxt)
+cr_doc_handler_get_ctxt (CRDocHandler const * a_this, gpointer * a_ctxt)
{
g_return_val_if_fail (a_this && a_this->priv, CR_BAD_PARAM_ERROR);
*Returns CR_OK upon successfull completion, an error code otherwise.
*/
enum CRStatus
-cr_doc_handler_get_result (CRDocHandler * a_this, gpointer * a_result)
+cr_doc_handler_get_result (CRDocHandler const * a_this, gpointer * a_result)
{
g_return_val_if_fail (a_this && a_this->priv, CR_BAD_PARAM_ERROR);
/**
* cr_doc_handler_associate_a_parser:
*Associates a parser to the current document handler
+ *
*@a_this: the current instance of document handler.
*@a_parser: the parser to associate.
*/
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
*destination media for style information.
*@param a_uri the uri of the imported style sheet.
*@param a_uri_default_ns the default namespace of URI
- *@param a_location the parsing location of the '@import'
+ *@param a_location the parsing location of the '\@import'
*keyword.
*of the imported style sheet.
*/
*
*@param a_this a pointer to the current instance of
*#CRDocHandler.
- *@param a_location the parsing location of the "@font-face"
+ *@param a_location the parsing location of the "\@font-face"
*keyword.
*/
void (*start_font_face) (CRDocHandler *a_this,
*#CRDocHandler.
*@param a_name the name of the page (if any, null otherwise).
*@param a_pseudo_page the pseudo page (if any, null otherwise).
- *@param a_location the parsing location of the "@page" keyword.
+ *@param a_location the parsing location of the "\@page" keyword.
*/
void (*start_page) (CRDocHandler *a_this,
CRString *a_name,
*@param a_this a pointer to the current instance of
*#CRDocHandler.
*@param a_name the name of the page (if any, null otherwise).
- *@parap a_pseudo_page the pseudo page (if any, null otherwise).
+ *@param a_pseudo_page the pseudo page (if any, null otherwise).
*/
void (*end_page) (CRDocHandler *a_this,
CRString *a_name,
enum CRStatus cr_doc_handler_set_result (CRDocHandler *a_this, gpointer a_result) ;
-enum CRStatus cr_doc_handler_get_result (CRDocHandler *a_this, gpointer * a_result) ;
+enum CRStatus cr_doc_handler_get_result (CRDocHandler const *a_this, gpointer * a_result) ;
enum CRStatus cr_doc_handler_set_ctxt (CRDocHandler *a_this, gpointer a_ctxt) ;
-enum CRStatus cr_doc_handler_get_ctxt (CRDocHandler *a_this, gpointer * a_ctxt) ;
+enum CRStatus cr_doc_handler_get_ctxt (CRDocHandler const *a_this, gpointer * a_ctxt) ;
enum CRStatus cr_doc_handler_set_default_sac_handler (CRDocHandler *a_this) ;
*/
/*
- *$Id: cr-enc-handler.c,v 1.8 2005/05/10 19:48:56 dodji Exp $
+ *$Id$
*/
/**
for (i = 0; gv_default_enc_handlers[i].encoding; i++) {
if (gv_default_enc_handlers[i].encoding == a_enc) {
- return (CREncHandler *)
- & gv_default_enc_handlers[i].encoding;
+ return (CREncHandler *) & gv_default_enc_handlers[i];
}
}
g_return_val_if_fail (a_alias_name != NULL, CR_BAD_PARAM_ERROR);
- alias_name_up = g_strdup (a_alias_name);
- g_ascii_strup (alias_name_up, -1);
+ alias_name_up = (guchar *) g_ascii_strup ((const gchar *) a_alias_name, -1);
for (i = 0; gv_default_aliases[i].name; i++) {
- if (!strcmp (gv_default_aliases[i].name, alias_name_up)) {
+ if (!strcmp (gv_default_aliases[i].name, (const gchar *) alias_name_up)) {
*a_enc = gv_default_aliases[i].encoding;
status = CR_OK;
break;
*/
/*
- *$Id: cr-enc-handler.h,v 1.6 2005/05/10 19:48:56 dodji Exp $
+ *$Id$
*/
/**
#include <string.h>
static enum CRStatus
-cr_font_family_to_string_real (CRFontFamily * a_this,
+cr_font_family_to_string_real (CRFontFamily const * a_this,
gboolean a_walk_list, GString ** a_string)
{
- guchar *name = NULL;
+ guchar const *name = NULL;
enum CRStatus result = CR_OK;
if (!*a_string) {
switch (a_this->type) {
case FONT_FAMILY_SANS_SERIF:
- name = (guchar *) "sans-serif";
+ name = (guchar const *) "sans-serif";
break;
case FONT_FAMILY_SERIF:
- name = (guchar *) "sans-serif";
+ name = (guchar const *) "sans-serif";
break;
case FONT_FAMILY_CURSIVE:
- name = (guchar *) "cursive";
+ name = (guchar const *) "cursive";
break;
case FONT_FAMILY_FANTASY:
- name = (guchar *) "fantasy";
+ name = (guchar const *) "fantasy";
break;
case FONT_FAMILY_MONOSPACE:
- name = (guchar *) "monospace";
+ name = (guchar const *) "monospace";
break;
case FONT_FAMILY_NON_GENERIC:
- name = (guchar *) a_this->name;
+ name = (guchar const *) a_this->name;
break;
default:
- name = (guchar *) NULL;
+ name = NULL;
break;
}
if (a_this->prev) {
g_string_append_printf (*a_string, ", %s", name);
} else {
- g_string_append (*a_string, name);
+ g_string_append (*a_string, (const gchar *) name);
}
}
if (a_walk_list == TRUE && a_this->next) {
cr_predefined_absolute_font_size_to_string (enum CRPredefinedAbsoluteFontSize
a_code)
{
- gchar *str = NULL;
+ gchar const *str = NULL;
switch (a_code) {
case FONT_SIZE_XX_SMALL:
- str = (gchar *) "xx-small";
+ str = "xx-small";
break;
case FONT_SIZE_X_SMALL:
- str = (gchar *) "x-small";
+ str = "x-small";
break;
case FONT_SIZE_SMALL:
- str = (gchar *) "small";
+ str = "small";
break;
case FONT_SIZE_MEDIUM:
- str = (gchar *) "medium";
+ str = "medium";
break;
case FONT_SIZE_LARGE:
- str = (gchar *) "large";
+ str = "large";
break;
case FONT_SIZE_X_LARGE:
- str = (gchar *) "x-large";
+ str = "x-large";
break;
case FONT_SIZE_XX_LARGE:
- str = (gchar *) "xx-large";
+ str = "xx-large";
break;
default:
- str = (gchar *) "unknown absolute font size value";
+ str = "unknown absolute font size value";
}
return str;
}
static const gchar *
cr_relative_font_size_to_string (enum CRRelativeFontSize a_code)
{
- gchar *str = NULL;
+ gchar const *str = NULL;
switch (a_code) {
case FONT_SIZE_LARGER:
- str = (gchar *) "larger";
+ str = "larger";
break;
case FONT_SIZE_SMALLER:
- str = (gchar *) "smaller";
+ str = "smaller";
break;
default:
- str = (gchar *) "unknown relative font size value";
+ str = "unknown relative font size value";
break;
}
return str;
/**
* cr_font_family_new:
* @a_type: the type of font family to create.
- * @a_name: the name of the font family:
+ * @a_name: the name of the font family.
*
* create a font family.
*
* g_free().
*/
guchar *
-cr_font_family_to_string (CRFontFamily * a_this,
+cr_font_family_to_string (CRFontFamily const * a_this,
gboolean a_walk_font_family_list)
{
enum CRStatus status = CR_OK;
GString *stringue = NULL;
if (!a_this) {
- result = g_strdup ("NULL");
+ result = (guchar *) g_strdup ("NULL");
g_return_val_if_fail (result, NULL);
return result;
}
&stringue);
if (status == CR_OK && stringue) {
- result = stringue->str;
+ result = (guchar *) stringue->str;
g_string_free (stringue, FALSE);
stringue = NULL;
a_family_to_prepend->next = a_this;
a_this->prev = a_family_to_prepend;
- return CR_OK;
+ return a_family_to_prepend;
}
/**
* Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_font_size_copy (CRFontSize * a_dst, CRFontSize * a_src)
+cr_font_size_copy (CRFontSize * a_dst, CRFontSize const * a_src)
{
g_return_val_if_fail (a_dst && a_src, CR_BAD_PARAM_ERROR);
enum CRPredefinedAbsoluteFontSize a_predefined)
{
g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ;
- g_return_val_if_fail (a_predefined >= PREDEFINED_ABSOLUTE_FONT_SIZE
- && a_predefined < NB_FONT_SIZE_TYPE,
+ g_return_val_if_fail (a_predefined >= FONT_SIZE_XX_SMALL
+ && a_predefined < NB_PREDEFINED_ABSOLUTE_FONT_SIZES,
CR_BAD_PARAM_ERROR) ;
a_this->type = PREDEFINED_ABSOLUTE_FONT_SIZE ;
* Returns TRUE if the current instance is set to 'inherit'.
*/
gboolean
-cr_font_size_is_set_to_inherit (CRFontSize *a_this)
+cr_font_size_is_set_to_inherit (CRFontSize const *a_this)
{
g_return_val_if_fail (a_this, FALSE) ;
* has to bee freed using g_free().
*/
gchar *
-cr_font_size_to_string (CRFontSize * a_this)
+cr_font_size_to_string (CRFontSize const * a_this)
{
gchar *str = NULL;
(a_this->value.predefined));
break;
case ABSOLUTE_FONT_SIZE:
- str = cr_num_to_string (&a_this->value.absolute);
+ str = (gchar *) cr_num_to_string (&a_this->value.absolute);
break;
case RELATIVE_FONT_SIZE:
str = g_strdup (cr_relative_font_size_to_string
* Returns the serialized form of #CRFontSizeAdjust
*/
gchar *
-cr_font_size_adjust_to_string (CRFontSizeAdjust * a_this)
+cr_font_size_adjust_to_string (CRFontSizeAdjust const * a_this)
{
gchar *str = NULL;
break;
case FONT_SIZE_ADJUST_NUMBER:
if (a_this->num)
- str = cr_num_to_string (a_this->num);
+ str = (gchar *) cr_num_to_string (a_this->num);
else
- str = g_strdup ("unknow font-size-adjust property value"); /* Should raise an error no?*/
+ str = g_strdup ("unknown font-size-adjust property value"); /* Should raise an error no?*/
break;
case FONT_SIZE_ADJUST_INHERIT:
str = g_strdup ("inherit");
/**
* cr_font_style_to_string:
- * @a_code the current instance of #CRFontStyle
+ * @a_code: the current instance of #CRFontStyle .
*
* Returns the serialized #CRFontStyle. The caller must free the returned
* string using g_free().
enum CRFontWeight
cr_font_weight_get_bolder (enum CRFontWeight a_weight)
{
- if (a_weight >= NB_FONT_WEIGHTS) {
+ if (a_weight == FONT_WEIGHT_INHERIT) {
+ cr_utils_trace_info ("can't return a bolder weight for FONT_WEIGHT_INHERIT") ;
+ return a_weight;
+ } else if (a_weight >= FONT_WEIGHT_900) {
return FONT_WEIGHT_900 ;
} else if (a_weight < FONT_WEIGHT_NORMAL) {
return FONT_WEIGHT_NORMAL ;
} else if (a_weight == FONT_WEIGHT_BOLDER
- || a_weight == FONT_WEIGHT_BOLDER) {
+ || a_weight == FONT_WEIGHT_LIGHTER) {
cr_utils_trace_info ("FONT_WEIGHT_BOLDER or FONT_WEIGHT_LIGHTER should not appear here") ;
return FONT_WEIGHT_NORMAL ;
} else {
CRFontFamily *a_family_to_append) ;
guchar *
-cr_font_family_to_string (CRFontFamily *a_this,
+cr_font_family_to_string (CRFontFamily const *a_this,
gboolean a_walk_font_family_list) ;
CRFontFamily *
enum CRStatus cr_font_size_clear (CRFontSize *a_this) ;
enum CRStatus cr_font_size_copy (CRFontSize *a_dst,
- CRFontSize *a_src) ;
+ CRFontSize const *a_src) ;
enum CRStatus cr_font_size_set_predefined_absolute_font_size (CRFontSize *a_this,
enum CRPredefinedAbsoluteFontSize a_predefined) ;
enum CRStatus cr_font_size_set_relative_font_size (CRFontSize *a_this,
enum CRStatus cr_font_size_set_to_inherit (CRFontSize *a_this) ;
-gboolean cr_font_size_is_set_to_inherit (CRFontSize *a_this) ;
+gboolean cr_font_size_is_set_to_inherit (CRFontSize const *a_this) ;
-gchar* cr_font_size_to_string (CRFontSize *a_this) ;
+gchar* cr_font_size_to_string (CRFontSize const *a_this) ;
void cr_font_size_destroy (CRFontSize *a_font_size) ;
CRFontSizeAdjust * cr_font_size_adjust_new (void) ;
-gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust *a_this) ;
+gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust const *a_this) ;
void cr_font_size_adjust_destroy (CRFontSizeAdjust *a_this) ;
G_END_DECLS
-#endif /* __CR_FONTS_H__ */
+#endif
/*we reached eof */
loop = FALSE;
} else {
- /*a pb occured !! */
- cr_utils_trace_debug ("an io error occured");
+ /*a pb occurred !! */
+ cr_utils_trace_debug ("an io error occurred");
status = CR_ERROR;
goto cleanup;
}
*we should free buf here because it's own by CRInput.
*(see the last parameter of cr_input_new_from_buf().
*/
- buf = NULL ;
+ buf = NULL;
}
cleanup:
* and only if this method returns CR_OK.
*/
enum CRStatus
-cr_input_end_of_input (CRInput * a_this, gboolean * a_end_of_input)
+cr_input_end_of_input (CRInput const * a_this, gboolean * a_end_of_input)
{
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_end_of_input, CR_BAD_PARAM_ERROR);
*before the end, -1 in case of error.
*/
glong
-cr_input_get_nb_bytes_left (CRInput * a_this)
+cr_input_get_nb_bytes_left (CRInput const * a_this)
{
g_return_val_if_fail (a_this && PRIVATE (a_this), -1);
g_return_val_if_fail (PRIVATE (a_this)->nb_bytes
enum CRStatus
cr_input_read_byte (CRInput * a_this, guchar * a_byte)
{
+ gulong nb_bytes_left = 0;
+
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_byte, CR_BAD_PARAM_ERROR);
if (PRIVATE (a_this)->end_of_input == TRUE)
return CR_END_OF_INPUT_ERROR;
+ nb_bytes_left = cr_input_get_nb_bytes_left (a_this);
+
+ if (nb_bytes_left < 1) {
+ return CR_END_OF_INPUT_ERROR;
+ }
+
*a_byte = PRIVATE (a_this)->in_buf[PRIVATE (a_this)->next_byte_index];
if (PRIVATE (a_this)->nb_bytes -
if (*a_char == '\n') {
PRIVATE (a_this)->end_of_line = TRUE;
}
-
}
return status;
*Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_input_get_line_num (CRInput * a_this, glong * a_line_num)
+cr_input_get_line_num (CRInput const * a_this, glong * a_line_num)
{
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_line_num, CR_BAD_PARAM_ERROR);
*Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_input_get_column_num (CRInput * a_this, glong * a_col)
+cr_input_get_column_num (CRInput const * a_this, glong * a_col)
{
g_return_val_if_fail (a_this && PRIVATE (a_this) && a_col,
CR_BAD_PARAM_ERROR);
}
+ *a_nb_chars = (gulong) nb_consumed;
+
if (nb_consumed && status == CR_END_OF_INPUT_ERROR) {
status = CR_OK;
}
*otherwise.
*/
enum CRStatus
-cr_input_peek_char (CRInput * a_this, guint32 * a_char)
+cr_input_peek_char (CRInput const * a_this, guint32 * a_char)
{
enum CRStatus status = CR_OK;
- glong consumed = 0,
+ gulong consumed = 0,
nb_bytes_left = 0;
g_return_val_if_fail (a_this && PRIVATE (a_this)
*CR_OUT_OF_BOUNDS_ERROR if the indexed byte is out of bounds.
*/
enum CRStatus
-cr_input_peek_byte (CRInput * a_this, enum CRSeekPos a_origin,
+cr_input_peek_byte (CRInput const * a_this, enum CRSeekPos a_origin,
gulong a_offset, guchar * a_byte)
{
gulong abs_offset = 0;
*Returns the read byte or 0 if something bad happened.
*/
guchar
-cr_input_peek_byte2 (CRInput * a_this, gulong a_offset, gboolean * a_eof)
+cr_input_peek_byte2 (CRInput const * a_this, gulong a_offset, gboolean * a_eof)
{
guchar result = 0;
enum CRStatus status = CR_ERROR;
*Gets the memory address of the byte located at a given offset
*in the input stream.
*
- *Returns the address, otherwise NULL if an error occured.
+ *Returns the address, otherwise NULL if an error occurred.
*/
guchar *
cr_input_get_byte_addr (CRInput * a_this, gulong a_offset)
*function returns CR_OK.
*/
enum CRStatus
-cr_input_get_cur_pos (CRInput * a_this, CRInputPos * a_pos)
+cr_input_get_cur_pos (CRInput const * a_this, CRInputPos * a_pos)
{
g_return_val_if_fail (a_this && PRIVATE (a_this) && a_pos,
CR_BAD_PARAM_ERROR);
*code otherwise.
*/
enum CRStatus
-cr_input_get_parsing_location (CRInput *a_this,
+cr_input_get_parsing_location (CRInput const *a_this,
CRParsingLocation *a_loc)
{
g_return_val_if_fail (a_this
*otherwise.
*/
enum CRStatus
-cr_input_get_cur_index (CRInput * a_this, glong * a_index)
+cr_input_get_cur_index (CRInput const * a_this, glong * a_index)
{
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_index, CR_BAD_PARAM_ERROR);
*Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_input_get_end_of_file (CRInput * a_this, gboolean * a_eof)
+cr_input_get_end_of_file (CRInput const * a_this, gboolean * a_eof)
{
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_eof, CR_BAD_PARAM_ERROR);
*otherwise.
*/
enum CRStatus
-cr_input_get_end_of_line (CRInput * a_this, gboolean * a_eol)
+cr_input_get_end_of_line (CRInput const * a_this, gboolean * a_eol)
{
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_eol, CR_BAD_PARAM_ERROR);
* Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_input_set_cur_pos (CRInput * a_this, CRInputPos * a_pos)
+cr_input_set_cur_pos (CRInput * a_this, CRInputPos const * a_pos)
{
g_return_val_if_fail (a_this && PRIVATE (a_this) && a_pos,
CR_BAD_PARAM_ERROR);
cr_input_consume_white_spaces (CRInput *a_this, gulong *a_nb_chars) ;
enum CRStatus
-cr_input_peek_byte (CRInput *a_this, enum CRSeekPos a_origin,
+cr_input_peek_byte (CRInput const *a_this, enum CRSeekPos a_origin,
gulong a_offset, guchar *a_byte) ;
guchar
-cr_input_peek_byte2 (CRInput *a_this, gulong a_offset,
+cr_input_peek_byte2 (CRInput const *a_this, gulong a_offset,
gboolean *a_eof) ;
enum CRStatus
-cr_input_peek_char (CRInput *a_this, guint32 *a_char) ;
+cr_input_peek_char (CRInput const *a_this, guint32 *a_char) ;
guchar *
cr_input_get_byte_addr (CRInput *a_this,
enum CRSeekPos a_origin, gint a_pos) ;
enum CRStatus
-cr_input_get_cur_index (CRInput *a_this, glong *a_index) ;
+cr_input_get_cur_index (CRInput const *a_this, glong *a_index) ;
enum CRStatus
cr_input_set_cur_index (CRInput *a_this, glong a_index) ;
enum CRStatus
-cr_input_get_cur_pos (CRInput *a_this, CRInputPos * a_pos) ;
+cr_input_get_cur_pos (CRInput const *a_this, CRInputPos * a_pos) ;
enum CRStatus
-cr_input_set_cur_pos (CRInput *a_this, CRInputPos *a_pos) ;
+cr_input_set_cur_pos (CRInput *a_this, CRInputPos const *a_pos) ;
enum CRStatus
-cr_input_get_parsing_location (CRInput *a_this,
+cr_input_get_parsing_location (CRInput const *a_this,
CRParsingLocation *a_loc) ;
enum CRStatus
-cr_input_get_end_of_line (CRInput *a_this, gboolean *a_eol) ;
+cr_input_get_end_of_line (CRInput const *a_this, gboolean *a_eol) ;
enum CRStatus
cr_input_set_end_of_line (CRInput *a_this, gboolean a_eol) ;
enum CRStatus
-cr_input_get_end_of_file (CRInput *a_this, gboolean *a_eof) ;
+cr_input_get_end_of_file (CRInput const *a_this, gboolean *a_eof) ;
enum CRStatus
cr_input_set_end_of_file (CRInput *a_this, gboolean a_eof) ;
cr_input_set_line_num (CRInput *a_this, glong a_line_num) ;
enum CRStatus
-cr_input_get_line_num (CRInput *a_this, glong *a_line_num) ;
+cr_input_get_line_num (CRInput const *a_this, glong *a_line_num) ;
enum CRStatus
cr_input_set_column_num (CRInput *a_this, glong a_col) ;
enum CRStatus
-cr_input_get_column_num (CRInput *a_this, glong *a_col) ;
+cr_input_get_column_num (CRInput const *a_this, glong *a_col) ;
enum CRStatus
cr_input_increment_line_num (CRInput *a_this,
glong a_increment) ;
glong
-cr_input_get_nb_bytes_left (CRInput *a_this) ;
+cr_input_get_nb_bytes_left (CRInput const *a_this) ;
enum CRStatus
-cr_input_end_of_input (CRInput *a_this, gboolean *a_end_of_input) ;
+cr_input_end_of_input (CRInput const *a_this, gboolean *a_end_of_input) ;
G_END_DECLS
*free the returned string.
*/
guchar *
-cr_num_to_string (CRNum * a_this)
+cr_num_to_string (CRNum const * a_this)
{
gdouble test_val = 0.0;
test_val = a_this->val - (glong) a_this->val;
if (!test_val) {
- tmp_char1 = g_strdup_printf ("%ld", (glong) a_this->val);
+ tmp_char1 = (guchar *) g_strdup_printf ("%ld", (glong) a_this->val);
} else {
- tmp_char1 = g_strdup_printf ("%.3f", a_this->val);
+ tmp_char1 = (guchar *) g_new0 (char, G_ASCII_DTOSTR_BUF_SIZE + 1);
+ if (tmp_char1 != NULL)
+ g_ascii_dtostr ((gchar *) tmp_char1, G_ASCII_DTOSTR_BUF_SIZE, a_this->val);
}
g_return_val_if_fail (tmp_char1, NULL);
}
if (tmp_char2) {
- result = g_strconcat (tmp_char1, tmp_char2, NULL);
+ result = (guchar *) g_strconcat ((gchar *) tmp_char1, tmp_char2, NULL);
g_free (tmp_char1);
} else {
result = tmp_char1;
*error code otherwise.
*/
enum CRStatus
-cr_num_copy (CRNum * a_dest, CRNum * a_src)
+cr_num_copy (CRNum * a_dest, CRNum const * a_src)
{
g_return_val_if_fail (a_dest && a_src, CR_BAD_PARAM_ERROR);
*Must be freed by cr_num_destroy().
*/
CRNum *
-cr_num_dup (CRNum * a_this)
+cr_num_dup (CRNum const * a_this)
{
CRNum *result = NULL;
enum CRStatus status = CR_OK;
*FALSE otherwise.
*/
gboolean
-cr_num_is_fixed_length (CRNum * a_this)
+cr_num_is_fixed_length (CRNum const * a_this)
{
gboolean result = FALSE;
enum CRNumType a_type) ;
CRNum *
-cr_num_dup (CRNum *a_this) ;
+cr_num_dup (CRNum const *a_this) ;
guchar *
-cr_num_to_string (CRNum *a_this) ;
+cr_num_to_string (CRNum const *a_this) ;
enum CRStatus
-cr_num_copy (CRNum *a_dest, CRNum *a_src) ;
+cr_num_copy (CRNum *a_dest, CRNum const *a_src) ;
enum CRStatus
cr_num_set (CRNum *a_this, gdouble a_val,
enum CRNumType a_type) ;
gboolean
-cr_num_is_fixed_length (CRNum *a_this) ;
+cr_num_is_fixed_length (CRNum const *a_this) ;
void
cr_num_destroy (CRNum *a_this) ;
cr_om_parser_init_default_sac_handler (CROMParser * a_this)
{
CRDocHandler *sac_handler = NULL;
- gboolean free_hdlr_if_error = FALSE;
+ gboolean created_handler = FALSE;
enum CRStatus status = CR_OK;
g_return_val_if_fail (a_this && PRIVATE (a_this)
if (!sac_handler) {
sac_handler = cr_doc_handler_new ();
- free_hdlr_if_error = TRUE;
+ created_handler = TRUE;
}
/*
sac_handler->end_media = end_media;
sac_handler->import_style = import_style;
- status = cr_parser_set_sac_handler (PRIVATE (a_this)->parser,
- sac_handler);
- if (status == CR_OK) {
- return CR_OK;
- }
-
- if (sac_handler && free_hdlr_if_error == TRUE) {
- cr_doc_handler_destroy (sac_handler);
- sac_handler = NULL;
+ if (created_handler) {
+ status = cr_parser_set_sac_handler (PRIVATE (a_this)->parser,
+ sac_handler);
+ cr_doc_handler_unref (sac_handler);
}
return status;
ParsingContext **ctxtptr = NULL;
CRStatement *stmt = NULL;
+ (void) a_page;
+ (void) a_pseudo_page;
+
g_return_if_fail (a_this);
+
ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
+
g_return_if_fail (status == CR_OK && ctxt);
+
g_return_if_fail (ctxt->cur_stmt
&& ctxt->cur_stmt->type == AT_PAGE_RULE_STMT
&& ctxt->stylesheet);
ParsingContext **ctxtptr = NULL;
CRStatement *stmts = NULL;
+ (void) a_media_list;
+
g_return_if_fail (a_this);
+
ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
+
g_return_if_fail (status == CR_OK && ctxt);
+
g_return_if_fail (ctxt
&& ctxt->cur_media_stmt
&& ctxt->cur_media_stmt->type == AT_MEDIA_RULE_STMT
stmts = cr_statement_append (ctxt->stylesheet->statements,
ctxt->cur_media_stmt);
+
if (!stmts) {
cr_statement_destroy (ctxt->cur_media_stmt);
ctxt->cur_media_stmt = NULL;
ParsingContext **ctxtptr = NULL;
GList *media_list = NULL ;
+ (void) a_uri_default_ns;
+
g_return_if_fail (a_this);
+
ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
+
g_return_if_fail (status == CR_OK && ctxt);
+
g_return_if_fail (ctxt->stylesheet);
uri = cr_string_dup (a_uri) ;
+
if (a_media_list)
media_list = cr_utils_dup_glist_of_cr_string (a_media_list) ;
+
stmt = cr_statement_new_at_import_rule
(ctxt->stylesheet, uri, media_list, NULL);
+
if (!stmt)
goto error;
ParsingContext *ctxt = NULL;
ParsingContext **ctxtptr = NULL;
+ (void) a_selector_list;
+
g_return_if_fail (a_this);
+
ctxtptr = &ctxt;
status = cr_doc_handler_get_ctxt (a_this, (gpointer *) ctxtptr);
+
g_return_if_fail (status == CR_OK && ctxt);
+
g_return_if_fail (ctxt->cur_stmt && ctxt->stylesheet);
if (ctxt->cur_stmt) {
}
}
+
a_selector_list = NULL; /*keep compiler happy */
}
PRIVATE (result)->parser = cr_parser_new_from_input (a_input);
if (!PRIVATE (result)->parser) {
- cr_utils_trace_info ("parsing instanciation failed");
+ cr_utils_trace_info ("parsing instantiation failed");
goto error;
}
*/
/*
- *$Id: cr-om-parser.h,v 1.9 2004/01/29 22:05:14 dodji Exp $
+ *$Id$
*/
#ifndef __CR_OM_PARSER_H__
*/
#define PEEK_NEXT_CHAR(a_this, a_to_char) \
{\
-enum CRStatus status ; \
-status = cr_tknzr_peek_char (PRIVATE (a_this)->tknzr, a_to_char) ; \
-CHECK_PARSING_STATUS (status, TRUE) \
+enum CRStatus pnc_status ; \
+pnc_status = cr_tknzr_peek_char (PRIVATE (a_this)->tknzr, a_to_char) ; \
+CHECK_PARSING_STATUS (pnc_status, TRUE) \
}
/**
g_free (a_this->msg);
}
- a_this->msg = g_strdup (a_msg);
+ a_this->msg = (guchar *) g_strdup ((const gchar *) a_msg);
}
/**
error:
cr_parser_push_error
- (a_this, "could not recognize next production", CR_ERROR);
+ (a_this, (const guchar *) "could not recognize next production", CR_ERROR);
cr_parser_dump_err_stack (a_this, TRUE);
}
cr_parser_push_error
- (a_this, "could not recognize next production", CR_ERROR);
+ (a_this, (const guchar *) "could not recognize next production", CR_ERROR);
if (PRIVATE (a_this)->sac_handler
&& PRIVATE (a_this)->sac_handler->unrecoverable_error) {
*coming the input stream given in parameter.
*
*Returns the newly created instance of #CRParser,
- *or NULL if an error occured.
+ *or NULL if an error occurred.
*/
CRParser *
cr_parser_new (CRTknzr * a_tknzr)
* Returns CR_OK upon succesful completion, an error code otherwise.
*/
enum CRStatus
-cr_parser_get_use_core_grammar (CRParser * a_this,
+cr_parser_get_use_core_grammar (CRParser const * a_this,
gboolean * a_use_core_grammar)
{
g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR);
CHECK_PARSING_STATUS_ERR
(a_this, status, FALSE,
- "while parsing declaration: next property is malformed",
+ (const guchar *) "while parsing declaration: next property is malformed",
CR_SYNTAX_ERROR);
READ_NEXT_CHAR (a_this, &cur_char);
status = CR_PARSING_ERROR;
cr_parser_push_error
(a_this,
- "while parsing declaration: this char must be ':'",
+ (const guchar *) "while parsing declaration: this char must be ':'",
CR_SYNTAX_ERROR);
goto error;
}
CHECK_PARSING_STATUS_ERR
(a_this, status, FALSE,
- "while parsing declaration: next expression is malformed",
+ (const guchar *) "while parsing declaration: next expression is malformed",
CR_SYNTAX_ERROR);
cr_parser_try_to_skip_spaces_and_comments (a_this);
CRSelector *selector = NULL;
gboolean start_selector = FALSE,
is_important = FALSE;
+ CRParsingLocation end_parsing_location;
g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR);
ENSURE_PARSING_COND_ERR
(a_this, cur_char == '{',
- "while parsing rulset: current char should be '{'",
+ (const guchar *) "while parsing rulset: current char should be '{'",
CR_SYNTAX_ERROR);
if (PRIVATE (a_this)->sac_handler
}
CHECK_PARSING_STATUS_ERR
(a_this, status, FALSE,
- "while parsing ruleset: next construction should be a declaration",
+ (const guchar *) "while parsing ruleset: next construction should be a declaration",
CR_SYNTAX_ERROR);
for (;;) {
end_of_ruleset:
cr_parser_try_to_skip_spaces_and_comments (a_this);
+ cr_parser_get_parsing_location (a_this, &end_parsing_location);
READ_NEXT_CHAR (a_this, &cur_char);
ENSURE_PARSING_COND_ERR
(a_this, cur_char == '}',
- "while parsing rulset: current char must be a '}'",
+ (const guchar *) "while parsing rulset: current char must be a '}'",
CR_SYNTAX_ERROR);
+ selector->location = end_parsing_location;
if (PRIVATE (a_this)->sac_handler
&& PRIVATE (a_this)->sac_handler->end_selector) {
PRIVATE (a_this)->sac_handler->end_selector
*in appendix D.1:
*
*import ::=
- *@import [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S*
+ *\@import [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S*
*
*Returns CR_OK upon sucessfull completion, an error code otherwise.
*/
*Parses a 'media' declaration as specified in the css2 spec at
*appendix D.1:
*
- *media ::= @media S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S*
+ *media ::= \@media S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S*
*
*Note that this function calls the required sac handlers during the parsing
*to notify media productions. See #CRDocHandler to know the callback called
- *during @media parsing.
+ *during \@media parsing.
*
*Returns CR_OK upon successfull completion, an error code otherwise.
*/
* cr_parser_parse_page:
*@a_this: the "this pointer" of the current instance of #CRParser.
*
- *Parses '@page' rule as specified in the css2 spec in appendix D.1:
+ *Parses '\@page' rule as specified in the css2 spec in appendix D.1:
*page ::= PAGE_SYM S* IDENT? pseudo_page? S*
*'{' S* declaration [ ';' S* declaration ]* '}' S*
*
* cr_parser_parse_font_face:
*@a_this: the current instance of #CRParser.
*
- *Parses the "@font-face" rule specified in the css1 spec in
+ *Parses the "\@font-face" rule specified in the css1 spec in
*appendix D.1:
*
*font_face ::= FONT_FACE_SYM S*
*otherwise.
*/
enum CRStatus
-cr_parser_get_parsing_location (CRParser *a_this,
+cr_parser_get_parsing_location (CRParser const *a_this,
CRParsingLocation *a_loc)
{
g_return_val_if_fail (a_this
enum CRStatus cr_parser_get_tknzr (CRParser *a_this, CRTknzr **a_tknzr) ;
-enum CRStatus cr_parser_get_parsing_location (CRParser *a_this, CRParsingLocation *a_loc) ;
+enum CRStatus cr_parser_get_parsing_location (CRParser const *a_this, CRParsingLocation *a_loc) ;
enum CRStatus cr_parser_try_to_skip_spaces_and_comments (CRParser *a_this) ;
enum CRStatus cr_parser_set_use_core_grammar (CRParser *a_this,
gboolean a_use_core_grammar) ;
-enum CRStatus cr_parser_get_use_core_grammar (CRParser *a_this,
+enum CRStatus cr_parser_get_use_core_grammar (CRParser const *a_this,
gboolean *a_use_core_grammar) ;
enum CRStatus cr_parser_parse (CRParser *a_this) ;
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
*/
enum CRStatus
cr_parsing_location_copy (CRParsingLocation *a_to,
- CRParsingLocation *a_from)
+ CRParsingLocation const *a_from)
{
g_return_val_if_fail (a_to && a_from, CR_BAD_PARAM_ERROR) ;
*Returns the serialized string or NULL in case of an error.
*/
gchar *
-cr_parsing_location_to_string (CRParsingLocation *a_this,
+cr_parsing_location_to_string (CRParsingLocation const *a_this,
enum CRParsingLocationSerialisationMask a_mask)
{
GString *result = NULL ;
* @a_fp: the file pointer to dump the parsing location to.
*/
void
-cr_parsing_location_dump (CRParsingLocation *a_this,
+cr_parsing_location_dump (CRParsingLocation const *a_this,
enum CRParsingLocationSerialisationMask a_mask,
FILE *a_fp)
{
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
enum CRStatus cr_parsing_location_init (CRParsingLocation *a_this) ;
enum CRStatus cr_parsing_location_copy (CRParsingLocation *a_to,
- CRParsingLocation *a_from) ;
+ CRParsingLocation const *a_from) ;
-gchar * cr_parsing_location_to_string (CRParsingLocation *a_this,
+gchar * cr_parsing_location_to_string (CRParsingLocation const *a_this,
enum CRParsingLocationSerialisationMask a_mask) ;
-void cr_parsing_location_dump (CRParsingLocation *a_this,
+void cr_parsing_location_dump (CRParsingLocation const *a_this,
enum CRParsingLocationSerialisationMask a_mask,
FILE *a_fp) ;
*Appends a property list to the current one.
*
*Returns the resulting prop list, or NULL if an error
- *occured
+ *occurred
*/
CRPropList *
cr_prop_list_append (CRPropList * a_this, CRPropList * a_to_append)
*@a_this: the current instance of #CRPropList
*@a_prop: the property to consider
*@a_decl: the declaration to consider
+ *
*Returns the resulting property list, or NULL in case
*of an error.
*/
*
*Prepends a propertie to a list of properties
*
- * Returns the new property list.
+ *Returns the new property list.
*/
CRPropList *
cr_prop_list_prepend2 (CRPropList * a_this,
*otherwise.
*/
enum CRStatus
-cr_prop_list_get_prop (CRPropList * a_this, CRString ** a_prop)
+cr_prop_list_get_prop (CRPropList const * a_this, CRString ** a_prop)
{
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_prop, CR_BAD_PARAM_ERROR);
* cr_prop_list_set_decl:
* @a_this: the current instance of #CRPropList
* @a_decl: the new property value.
+ *
* Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
* cr_prop_list_get_decl:
* @a_this: the current instance of #CRPropList
* @a_decl: out parameter. The property value
+ *
* Returns CR_OK upon successful completion.
*/
enum CRStatus
-cr_prop_list_get_decl (CRPropList * a_this, CRDeclaration ** a_decl)
+cr_prop_list_get_decl (CRPropList const * a_this, CRDeclaration ** a_decl)
{
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_decl, CR_BAD_PARAM_ERROR);
}
/**
- * cr_prop_list_detroy:
+ * cr_prop_list_destroy:
* @a_this: the current instance of #CRPropList
*/
void
enum CRStatus cr_prop_list_set_prop (CRPropList *a_this,
CRString *a_prop) ;
-enum CRStatus cr_prop_list_get_prop (CRPropList *a_this,
+enum CRStatus cr_prop_list_get_prop (CRPropList const *a_this,
CRString **a_prop) ;
enum CRStatus cr_prop_list_lookup_prop (CRPropList *a_this,
enum CRStatus cr_prop_list_set_decl (CRPropList *a_this,
CRDeclaration *a_decl);
-enum CRStatus cr_prop_list_get_decl (CRPropList *a_this,
+enum CRStatus cr_prop_list_get_decl (CRPropList const *a_this,
CRDeclaration **a_decl) ;
CRPropList * cr_prop_list_unlink (CRPropList *a_this,
/**
* cr_pseudo_to_string:
* @a_this: the current instance of #CRPseud.
+ *
* Returns the serialized pseudo. Caller must free the returned
* string using g_free().
*/
guchar *
-cr_pseudo_to_string (CRPseudo * a_this)
+cr_pseudo_to_string (CRPseudo const * a_this)
{
guchar *result = NULL;
GString *str_buf = NULL;
goto error;
}
- name = g_strndup (a_this->name->stryng->str,
+ name = (guchar *) g_strndup (a_this->name->stryng->str,
a_this->name->stryng->len);
if (name) {
- g_string_append (str_buf, name);
+ g_string_append (str_buf, (const gchar *) name);
g_free (name);
name = NULL;
}
if (a_this->name == NULL)
goto error;
- name = g_strndup (a_this->name->stryng->str,
+ name = (guchar *) g_strndup (a_this->name->stryng->str,
a_this->name->stryng->len);
if (a_this->extra) {
- arg = g_strndup (a_this->extra->stryng->str,
+ arg = (guchar *) g_strndup (a_this->extra->stryng->str,
a_this->extra->stryng->len);
}
name = NULL;
if (arg) {
- g_string_append (str_buf, arg);
+ g_string_append (str_buf, (const gchar *) arg);
g_free (arg);
arg = NULL;
}
}
if (str_buf) {
- result = str_buf->str;
+ result = (guchar *) str_buf->str;
g_string_free (str_buf, FALSE);
str_buf = NULL;
}
*
*/
void
-cr_pseudo_dump (CRPseudo * a_this, FILE * a_fp)
+cr_pseudo_dump (CRPseudo const * a_this, FILE * a_fp)
{
guchar *tmp_str = NULL;
CRPseudo * cr_pseudo_new (void) ;
-guchar * cr_pseudo_to_string (CRPseudo *a_this) ;
+guchar * cr_pseudo_to_string (CRPseudo const *a_this) ;
-void cr_pseudo_dump (CRPseudo *a_this, FILE *a_fp) ;
+void cr_pseudo_dump (CRPseudo const *a_this, FILE *a_fp) ;
void cr_pseudo_destroy (CRPseudo *a_this) ;
*/
#include <config.h>
+
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include "cr-rgb.h"
#include "cr-term.h"
#include "cr-parser.h"
-static CRRgb gv_standard_colors[] = {
- {"aliceblue", 240, 248, 255, 0,},
- {"antiquewhite", 250, 235, 215, 0},
- {"aqua", 0, 255, 255, 0},
- {"aquamarine", 127, 255, 212, 0},
- {"azure", 240, 255, 255, 0},
- {"beige", 245, 245, 220, 0},
- {"bisque", 255, 228, 196, 0},
- {"black", 0, 0, 0, 0},
- {"blanchedalmond", 255, 235, 205, 0},
- {"blue", 0, 0, 255, 0},
- {"blueviolet", 138, 43, 226, 0},
- {"brown", 165, 42, 42, 0},
- {"burlywood", 222, 184, 135, 0},
- {"cadetblue", 95, 158, 160, 0},
- {"chartreuse", 127, 255, 0, 0},
- {"chocolate", 210, 105, 30, 0},
- {"coral", 255, 127, 80, 0},
- {"cornflowerblue", 100, 149, 237, 0},
- {"cornsilk", 255, 248, 220, 0},
- {"crimson", 220, 20, 60, 0},
- {"cyan", 0, 255, 255, 0},
- {"darkblue", 0, 0, 139, 0},
- {"darkcyan", 0, 139, 139, 0},
- {"darkgoldenrod", 184, 134, 11, 0},
- {"darkgray", 169, 169, 169, 0},
- {"darkgreen", 0, 100, 0, 0},
- {"darkgrey", 169, 169, 169, 0},
- {"darkkhaki", 189, 183, 107, 0},
- {"darkmagenta", 139, 0, 139, 0},
- {"darkolivegreen", 85, 107, 47, 0},
- {"darkorange", 255, 140, 0, 0},
- {"darkorchid", 153, 50, 204, 0},
- {"darkred", 139, 0, 0, 0},
- {"darksalmon", 233, 150, 122, 0},
- {"darkseagreen", 143, 188, 143, 0},
- {"darkslateblue", 72, 61, 139, 0},
- {"darkslategray", 47, 79, 79, 0},
- {"darkslategrey", 47, 79, 79, 0},
- {"darkturquoise", 0, 206, 209, 0},
- {"darkviolet", 148, 0, 211, 0},
- {"deeppink", 255, 20, 147, 0},
- {"deepskyblue", 0, 191, 255, 0},
- {"dimgray", 105, 105, 105, 0},
- {"dimgrey", 105, 105, 105, 0},
- {"dodgerblue", 30, 144, 255, 0},
- {"firebrick", 178, 34, 34, 0},
- {"floralwhite", 255, 250, 240, 0},
- {"forestgreen", 34, 139, 34, 0},
- {"fuchsia", 255, 0, 255, 0},
- {"gainsboro", 220, 220, 220, 0},
- {"ghostwhite", 248, 248, 255, 0},
- {"gold", 255, 215, 0, 0},
- {"goldenrod", 218, 165, 32, 0},
- {"gray", 128, 128, 128, 0},
- {"grey", 128, 128, 128, 0},
- {"green", 0, 128, 0, 0},
- {"greenyellow", 173, 255, 47, 0},
- {"honeydew", 240, 255, 240, 0},
- {"hotpink", 255, 105, 180, 0},
- {"indianred", 205, 92, 92, 0},
- {"indigo", 75, 0, 130, 0},
- {"ivory", 255, 255, 240, 0},
- {"khaki", 240, 230, 140, 0},
- {"lavender", 230, 230, 250, 0},
- {"lavenderblush", 255, 240, 245, 0},
- {"lawngreen", 124, 252, 0, 0},
- {"lemonchiffon", 255, 250, 205, 0},
- {"lightblue", 173, 216, 230, 0},
- {"lightcoral", 240, 128, 128, 0},
- {"lightcyan", 224, 255, 255, 0},
- {"lightgoldenrodyellow", 250, 250, 210, 0},
- {"lightgray", 211, 211, 211, 0},
- {"lightgreen", 144, 238, 144, 0},
- {"lightgrey", 211, 211, 211, 0},
- {"lightpink", 255, 182, 193, 0},
- {"lightsalmon", 255, 160, 122, 0},
- {"lightseagreen", 32, 178, 170, 0},
- {"lightskyblue", 135, 206, 250, 0},
- {"lightslategray", 119, 136, 153, 0},
- {"lightslategrey", 119, 136, 153, 0},
- {"lightsteelblue", 176, 196, 222, 0},
- {"lightyellow", 255, 255, 224, 0},
- {"lime", 0, 255, 0, 0},
- {"limegreen", 50, 205, 50, 0},
- {"linen", 250, 240, 230, 0},
- {"magenta", 255, 0, 255, 0},
- {"maroon", 128, 0, 0, 0},
- {"mediumaquamarine", 102, 205, 170, 0},
- {"mediumblue", 0, 0, 205, 0},
- {"mediumorchid", 186, 85, 211, 0},
- {"mediumpurple", 147, 112, 219, 0},
- {"mediumseagreen", 60, 179, 113, 0},
- {"mediumslateblue", 123, 104, 238, 0},
- {"mediumspringgreen", 0, 250, 154, 0},
- {"mediumturquoise", 72, 209, 204, 0},
- {"mediumvioletred", 199, 21, 133, 0},
- {"midnightblue", 25, 25, 112, 0},
- {"mintcream", 245, 255, 250, 0},
- {"mistyrose", 255, 228, 225, 0},
- {"moccasin", 255, 228, 181, 0},
- {"navajowhite", 255, 222, 173, 0},
- {"navy", 0, 0, 128, 0},
- {"oldlace", 253, 245, 230, 0},
- {"olive", 128, 128, 0, 0},
- {"olivedrab", 107, 142, 35, 0},
- {"orange", 255, 165, 0, 0},
- {"orangered", 255, 69, 0, 0},
- {"orchid", 218, 112, 214, 0},
- {"palegoldenrod", 238, 232, 170, 0},
- {"palegreen", 152, 251, 152, 0},
- {"paleturquoise", 175, 238, 238, 0},
- {"palevioletred", 219, 112, 147, 0},
- {"papayawhip", 255, 239, 213, 0},
- {"peachpuff", 255, 218, 185, 0},
- {"peru", 205, 133, 63, 0},
- {"pink", 255, 192, 203, 0},
- {"plum", 221, 160, 221, 0},
- {"powderblue", 176, 224, 230, 0},
- {"purple", 128, 0, 128, 0},
- {"red", 255, 0, 0, 0},
- {"rosybrown", 188, 143, 143, 0},
- {"royalblue", 65, 105, 225, 0},
- {"saddlebrown", 139, 69, 19, 0},
- {"salmon", 250, 128, 114, 0},
- {"sandybrown", 244, 164, 96, 0},
- {"seagreen", 46, 139, 87, 0},
- {"seashell", 255, 245, 238, 0},
- {"sienna", 160, 82, 45, 0},
- {"silver", 192, 192, 192, 0},
- {"skyblue", 135, 206, 235, 0},
- {"slateblue", 106, 90, 205, 0},
- {"slategray", 112, 128, 144, 0},
- {"slategrey", 112, 128, 144, 0},
- {"snow", 255, 250, 250, 0},
- {"springgreen", 0, 255, 127, 0},
- {"steelblue", 70, 130, 180, 0},
- {"tan", 210, 180, 140, 0},
- {"teal", 0, 128, 128, 0},
- {"thistle", 216, 191, 216, 0},
- {"tomato", 255, 99, 71, 0},
- {"turquoise", 64, 224, 208, 0},
- {"violet", 238, 130, 238, 0},
- {"wheat", 245, 222, 179, 0},
- {"white", 255, 255, 255, 0},
- {"whitesmoke", 245, 245, 245, 0,},
- {"yellow", 255, 255, 0, 0,},
- {"yellowgreen", 154, 205, 50, 0,},
- {"transparent", 255, 255, 255, 0, 0, 1}
+static const CRRgb gv_standard_colors[] = {
+ {(const guchar*)"aliceblue", 240, 248, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"antiquewhite", 250, 235, 215, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"aqua", 0, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"aquamarine", 127, 255, 212, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"azure", 240, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"beige", 245, 245, 220, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"bisque", 255, 228, 196, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"black", 0, 0, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"blanchedalmond", 255, 235, 205, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"blue", 0, 0, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"blueviolet", 138, 43, 226, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"brown", 165, 42, 42, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"burlywood", 222, 184, 135, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"cadetblue", 95, 158, 160, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"chartreuse", 127, 255, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"chocolate", 210, 105, 30, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"coral", 255, 127, 80, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"cornflowerblue", 100, 149, 237, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"cornsilk", 255, 248, 220, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"crimson", 220, 20, 60, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"cyan", 0, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkblue", 0, 0, 139, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkcyan", 0, 139, 139, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkgoldenrod", 184, 134, 11, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkgray", 169, 169, 169, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkgreen", 0, 100, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkgrey", 169, 169, 169, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkkhaki", 189, 183, 107, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkmagenta", 139, 0, 139, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkolivegreen", 85, 107, 47, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkorange", 255, 140, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkorchid", 153, 50, 204, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkred", 139, 0, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darksalmon", 233, 150, 122, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkseagreen", 143, 188, 143, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkslateblue", 72, 61, 139, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkslategray", 47, 79, 79, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkslategrey", 47, 79, 79, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkturquoise", 0, 206, 209, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"darkviolet", 148, 0, 211, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"deeppink", 255, 20, 147, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"deepskyblue", 0, 191, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"dimgray", 105, 105, 105, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"dimgrey", 105, 105, 105, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"dodgerblue", 30, 144, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"firebrick", 178, 34, 34, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"floralwhite", 255, 250, 240, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"forestgreen", 34, 139, 34, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"fuchsia", 255, 0, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"gainsboro", 220, 220, 220, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"ghostwhite", 248, 248, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"gold", 255, 215, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"goldenrod", 218, 165, 32, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"gray", 128, 128, 128, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"green", 0, 128, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"greenyellow", 173, 255, 47, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"grey", 128, 128, 128, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"honeydew", 240, 255, 240, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"hotpink", 255, 105, 180, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"indianred", 205, 92, 92, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"indigo", 75, 0, 130, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"ivory", 255, 255, 240, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"khaki", 240, 230, 140, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lavender", 230, 230, 250, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lavenderblush", 255, 240, 245, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lawngreen", 124, 252, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lemonchiffon", 255, 250, 205, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightblue", 173, 216, 230, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightcoral", 240, 128, 128, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightcyan", 224, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightgoldenrodyellow", 250, 250, 210, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightgray", 211, 211, 211, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightgreen", 144, 238, 144, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightgrey", 211, 211, 211, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightpink", 255, 182, 193, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightsalmon", 255, 160, 122, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightseagreen", 32, 178, 170, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightskyblue", 135, 206, 250, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightslategray", 119, 136, 153, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightslategrey", 119, 136, 153, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightsteelblue", 176, 196, 222, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lightyellow", 255, 255, 224, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"lime", 0, 255, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"limegreen", 50, 205, 50, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"linen", 250, 240, 230, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"magenta", 255, 0, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"maroon", 128, 0, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumaquamarine", 102, 205, 170, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumblue", 0, 0, 205, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumorchid", 186, 85, 211, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumpurple", 147, 112, 219, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumseagreen", 60, 179, 113, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumslateblue", 123, 104, 238, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumspringgreen", 0, 250, 154, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumturquoise", 72, 209, 204, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mediumvioletred", 199, 21, 133, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"midnightblue", 25, 25, 112, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mintcream", 245, 255, 250, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"mistyrose", 255, 228, 225, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"moccasin", 255, 228, 181, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"navajowhite", 255, 222, 173, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"navy", 0, 0, 128, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"oldlace", 253, 245, 230, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"olive", 128, 128, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"olivedrab", 107, 142, 35, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"orange", 255, 165, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"orangered", 255, 69, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"orchid", 218, 112, 214, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"palegoldenrod", 238, 232, 170, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"palegreen", 152, 251, 152, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"paleturquoise", 175, 238, 238, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"palevioletred", 219, 112, 147, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"papayawhip", 255, 239, 213, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"peachpuff", 255, 218, 185, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"peru", 205, 133, 63, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"pink", 255, 192, 203, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"plum", 221, 160, 221, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"powderblue", 176, 224, 230, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"purple", 128, 0, 128, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"red", 255, 0, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"rosybrown", 188, 143, 143, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"royalblue", 65, 105, 225, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"saddlebrown", 139, 69, 19, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"salmon", 250, 128, 114, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"sandybrown", 244, 164, 96, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"seagreen", 46, 139, 87, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"seashell", 255, 245, 238, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"sienna", 160, 82, 45, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"silver", 192, 192, 192, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"skyblue", 135, 206, 235, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"slateblue", 106, 90, 205, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"slategray", 112, 128, 144, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"slategrey", 112, 128, 144, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"snow", 255, 250, 250, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"springgreen", 0, 255, 127, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"steelblue", 70, 130, 180, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"tan", 210, 180, 140, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"teal", 0, 128, 128, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"thistle", 216, 191, 216, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"tomato", 255, 99, 71, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"transparent", 255, 255, 255, FALSE, FALSE, TRUE, {0,0,0}},
+ {(const guchar*)"turquoise", 64, 224, 208, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"violet", 238, 130, 238, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"wheat", 245, 222, 179, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"white", 255, 255, 255, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"whitesmoke", 245, 245, 245, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"yellow", 255, 255, 0, FALSE, FALSE, FALSE, {0,0,0}},
+ {(const guchar*)"yellowgreen", 154, 205, 50, FALSE, FALSE, FALSE, {0,0,0}}
};
/**
*rgb. MUST BE FREED by the caller using g_free().
*/
guchar *
-cr_rgb_to_string (CRRgb * a_this)
+cr_rgb_to_string (CRRgb const * a_this)
{
guchar *result = NULL;
GString *str_buf = NULL;
}
if (str_buf) {
- result = str_buf->str;
+ result = (guchar *) str_buf->str;
g_string_free (str_buf, FALSE);
}
*to a file.
*/
void
-cr_rgb_dump (CRRgb * a_this, FILE * a_fp)
+cr_rgb_dump (CRRgb const * a_this, FILE * a_fp)
{
guchar *str = NULL;
* Returns TRUE if the rgb is set to the value "inherit", FALSE otherwise.
*/
gboolean
-cr_rgb_is_set_to_inherit (CRRgb *a_this)
+cr_rgb_is_set_to_inherit (CRRgb const *a_this)
{
g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ;
*transparent, FALSE otherwise.
*/
gboolean
-cr_rgb_is_set_to_transparent (CRRgb *a_this)
+cr_rgb_is_set_to_transparent (CRRgb const *a_this)
{
g_return_val_if_fail (a_this, FALSE) ;
return a_this->is_transparent ;
*Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_rgb_set_from_rgb (CRRgb * a_this, CRRgb * a_rgb)
+cr_rgb_set_from_rgb (CRRgb * a_this, CRRgb const * a_rgb)
{
g_return_val_if_fail (a_this && a_rgb, CR_BAD_PARAM_ERROR);
return CR_OK;
}
+static int
+cr_rgb_color_name_compare (const void *a,
+ const void *b)
+{
+ const char *a_color_name = a;
+ const CRRgb *rgb = b;
+
+ return g_ascii_strcasecmp (a_color_name, (const char *) rgb->name);
+}
+
/**
* cr_rgb_set_from_name:
* @a_this: the current instance of #CRRgb
* @a_color_name: the color name
- *
+ *
* Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_rgb_set_from_name (CRRgb * a_this, const guchar * a_color_name)
{
- gulong i = 0;
enum CRStatus status = CR_OK;
+ CRRgb *result;
g_return_val_if_fail (a_this && a_color_name, CR_BAD_PARAM_ERROR);
- for (i = 0; i < sizeof (gv_standard_colors); i++) {
- if (!strcmp (a_color_name, gv_standard_colors[i].name)) {
- cr_rgb_set_from_rgb (a_this, &gv_standard_colors[i]);
- break;
- }
- }
-
- if (i < sizeof (gv_standard_colors))
- status = CR_OK;
+ result = bsearch (a_color_name,
+ gv_standard_colors,
+ G_N_ELEMENTS (gv_standard_colors),
+ sizeof (gv_standard_colors[0]),
+ cr_rgb_color_name_compare);
+ if (result != NULL)
+ cr_rgb_set_from_rgb (a_this, result);
else
status = CR_UNKNOWN_TYPE_ERROR;
g_return_val_if_fail (a_this && a_hex, CR_BAD_PARAM_ERROR);
- if (strlen (a_hex) == 3) {
+ if (strlen ((const char *) a_hex) == 3) {
for (i = 0; i < 3; i++) {
if (a_hex[i] >= '0' && a_hex[i] <= '9') {
colors[i] = a_hex[i] - '0';
status = CR_UNKNOWN_TYPE_ERROR;
}
}
- } else if (strlen (a_hex) == 6) {
+ } else if (strlen ((const char *) a_hex) == 6) {
for (i = 0; i < 6; i++) {
if (a_hex[i] >= '0' && a_hex[i] <= '9') {
colors[i / 2] <<= 4;
} else {
status = cr_rgb_set_from_name
(a_this,
- a_value->content.str->stryng->str) ;
+ (const guchar *) a_value->content.str->stryng->str) ;
}
} else {
cr_utils_trace_info
&& a_value->content.str->stryng->str) {
status = cr_rgb_set_from_hex_str
(a_this,
- a_value->content.str->stryng->str) ;
+ (const guchar *) a_value->content.str->stryng->str) ;
} else {
cr_utils_trace_info
("a_value has NULL string value") ;
}
enum CRStatus
-cr_rgb_copy (CRRgb *a_dest, CRRgb*a_src)
+cr_rgb_copy (CRRgb *a_dest, CRRgb const *a_src)
{
g_return_val_if_fail (a_dest && a_src,
CR_BAD_PARAM_ERROR) ;
g_return_val_if_fail (a_str, NULL);
- parser = cr_parser_new_from_buf ((guchar*)a_str, strlen (a_str),
- a_enc, FALSE) ;
+ parser = cr_parser_new_from_buf ((guchar *) a_str, strlen ((const char *) a_str), a_enc, FALSE);
g_return_val_if_fail (parser, NULL);
gulong a_green, gulong a_blue,
gboolean a_is_percentage) ;
-enum CRStatus cr_rgb_copy (CRRgb *a_dest, CRRgb*a_src) ;
+enum CRStatus cr_rgb_copy (CRRgb *a_dest, CRRgb const *a_src) ;
enum CRStatus cr_rgb_set_to_inherit (CRRgb *a_this, gboolean a_inherit) ;
-gboolean cr_rgb_is_set_to_inherit (CRRgb *a_this) ;
+gboolean cr_rgb_is_set_to_inherit (CRRgb const *a_this) ;
-gboolean cr_rgb_is_set_to_transparent (CRRgb *a_this) ;
+gboolean cr_rgb_is_set_to_transparent (CRRgb const *a_this) ;
enum CRStatus cr_rgb_set_to_transparent (CRRgb *a_this,
gboolean a_is_transparent) ;
-enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this, CRRgb *a_rgb) ;
+enum CRStatus cr_rgb_set_from_rgb (CRRgb *a_this, CRRgb const *a_rgb) ;
enum CRStatus cr_rgb_set_from_name (CRRgb *a_this, const guchar *a_color_name) ;
enum CRStatus cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value);
-guchar * cr_rgb_to_string (CRRgb *a_this) ;
+guchar * cr_rgb_to_string (CRRgb const *a_this) ;
-void cr_rgb_dump (CRRgb *a_this, FILE *a_fp) ;
+void cr_rgb_dump (CRRgb const *a_this, FILE *a_fp) ;
void cr_rgb_destroy (CRRgb *a_this) ;
static xmlNode *get_next_parent_element_node (xmlNode * a_node);
+/* Quick strcmp. Test only for == 0 or != 0, not < 0 or > 0. */
+#define strqcmp(str,lit,lit_len) \
+ (strlen (str) != (lit_len) || memcmp (str, lit, lit_len))
+
static gboolean
lang_pseudo_class_handler (CRSelEng * a_this,
CRAdditionalSel * a_sel, xmlNode * a_node)
&& a_sel->content.pseudo->name->stryng
&& a_node, CR_BAD_PARAM_ERROR);
- if (strncmp (a_sel->content.pseudo->name->stryng->str,
+ if (strqcmp (a_sel->content.pseudo->name->stryng->str,
"lang", 4)
- || !a_sel->content.pseudo->type == FUNCTION_PSEUDO) {
+ || a_sel->content.pseudo->type != FUNCTION_PSEUDO) {
cr_utils_trace_info ("This handler is for :lang only");
return CR_BAD_PSEUDO_CLASS_SEL_HANDLER_ERROR;
}
|| a_sel->content.pseudo->extra->stryng->len < 2)
return FALSE;
for (; node; node = get_next_parent_element_node (node)) {
- val = xmlGetProp (node, "lang");
+ val = xmlGetProp (node, (const xmlChar *) "lang");
if (val
- && !strncmp (val,
+ && !strqcmp ((const char *) val,
a_sel->content.pseudo->extra->stryng->str,
a_sel->content.pseudo->extra->stryng->len)) {
result = TRUE;
if (strcmp (a_sel->content.pseudo->name->stryng->str,
"first-child")
- || !a_sel->content.pseudo->type == IDENT_PSEUDO) {
+ || a_sel->content.pseudo->type != IDENT_PSEUDO) {
cr_utils_trace_info ("This handler is for :first-child only");
return CR_BAD_PSEUDO_CLASS_SEL_HANDLER_ERROR;
}
&& a_node, CR_BAD_PARAM_ERROR);
status = cr_sel_eng_get_pseudo_class_selector_handler
- (a_this, a_add_sel->content.pseudo->name->stryng->str,
+ (a_this, (guchar *) a_add_sel->content.pseudo->name->stryng->str,
a_add_sel->content.pseudo->type, &handler);
if (status != CR_OK || !handler)
return FALSE;
&& a_add_sel->content.class_name->stryng->str
&& a_node, FALSE);
- if (xmlHasProp (a_node, "class")) {
- klass = xmlGetProp (a_node, "class");
+ if (xmlHasProp (a_node, (const xmlChar *) "class")) {
+ klass = xmlGetProp (a_node, (const xmlChar *) "class");
for (cur = klass; cur && *cur; cur++) {
while (cur && *cur
&& cr_utils_is_white_space (*cur)
== TRUE)
cur++;
- if (!strncmp (cur,
+ if (!strncmp ((const char *) cur,
a_add_sel->content.class_name->stryng->str,
a_add_sel->content.class_name->stryng->len)) {
cur += a_add_sel->content.class_name->stryng->len;
if ((cur && !*cur)
|| cr_utils_is_white_space (*cur) == TRUE)
result = TRUE;
+ } else { /* if it doesn't match, */
+ /* then skip to next whitespace character to try again */
+ while (cur && *cur && !(cr_utils_is_white_space(*cur) == TRUE))
+ cur++;
}
if (cur && !*cur)
break ;
&& a_add_sel->type == ID_ADD_SELECTOR
&& a_node, FALSE);
- if (xmlHasProp (a_node, "id")) {
- id = xmlGetProp (a_node, "id");
- if (!strncmp (id, a_add_sel->content.id_name->stryng->str,
+ if (xmlHasProp (a_node, (const xmlChar *) "id")) {
+ id = xmlGetProp (a_node, (const xmlChar *) "id");
+ if (!strqcmp ((const char *) id, a_add_sel->content.id_name->stryng->str,
a_add_sel->content.id_name->stryng->len)) {
result = TRUE;
}
return FALSE;
if (!xmlHasProp (a_node,
- cur_sel->name->stryng->str))
+ (const xmlChar *) cur_sel->name->stryng->str))
return FALSE;
break;
if (!xmlHasProp
(a_node,
- cur_sel->name->stryng->str))
+ (const xmlChar *) cur_sel->name->stryng->str))
return FALSE;
value = xmlGetProp
(a_node,
- cur_sel->name->stryng->str);
+ (const xmlChar *) cur_sel->name->stryng->str);
if (value
&& strcmp
- (value,
+ ((const char *) value,
cur_sel->value->stryng->str)) {
xmlFree (value);
return FALSE;
if (!xmlHasProp
(a_node,
- cur_sel->name->stryng->str))
+ (const xmlChar *) cur_sel->name->stryng->str))
return FALSE;
value = xmlGetProp
(a_node,
- cur_sel->name->stryng->str);
+ (const xmlChar *) cur_sel->name->stryng->str);
if (!value)
return FALSE;
ptr2 = cur;
if (!strncmp
- (ptr1,
+ ((const char *) ptr1,
cur_sel->value->stryng->str,
ptr2 - ptr1 + 1)) {
found = TRUE;
if (!xmlHasProp
(a_node,
- cur_sel->name->stryng->str))
+ (const xmlChar *) cur_sel->name->stryng->str))
return FALSE;
value = xmlGetProp
(a_node,
- cur_sel->name->stryng->str);
+ (const xmlChar *) cur_sel->name->stryng->str);
/*
*here, make sure value is an hyphen
ptr2 = cur;
if (g_strstr_len
- (ptr1, ptr2 - ptr1 + 1,
+ ((const gchar *) ptr1, ptr2 - ptr1 + 1,
cur_sel->value->stryng->str)
== (gchar *) ptr1) {
found = TRUE;
&& cur_sel->name->stryng
&& cur_sel->name->stryng->str)
&& (!strcmp (cur_sel->name->stryng->str,
- cur_node->name)))
+ (const char *) cur_node->name)))
|| (cur_sel->type_mask & UNIVERSAL_SELECTOR)) {
/*
*this simple selector
*case, *a_len is set to the actual number of ruleset found.
*@return CR_BAD_PARAM_ERROR in case any of the given parameter are
*bad (e.g null pointer).
- *@return CR_ERROR if any other error occured.
+ *@return CR_ERROR if any other error occurred.
*/
static enum CRStatus
cr_sel_eng_get_matched_rulesets_real (CRSelEng * a_this,
}
memset (handler_entry, 0,
sizeof (struct CRPseudoClassSelHandlerEntry));
- handler_entry->name = g_strdup (a_name);
+ handler_entry->name = (guchar *) g_strdup ((const gchar *) a_name);
handler_entry->type = a_type;
handler_entry->handler = a_handler;
list = g_list_append (PRIVATE (a_this)->pcs_handlers, handler_entry);
for (elem = PRIVATE (a_this)->pcs_handlers;
elem; elem = g_list_next (elem)) {
entry = elem->data;
- if (!strcmp (entry->name, a_name)
+ if (!strcmp ((const char *) entry->name, (const char *) a_name)
&& entry->type == a_type) {
found = TRUE;
break;
for (elem = PRIVATE (a_this)->pcs_handlers;
elem; elem = g_list_next (elem)) {
entry = elem->data;
- if (!strcmp (a_name, entry->name)
+ if (!strcmp ((const char *) a_name, (const char *) entry->name)
&& entry->type == a_type) {
found = TRUE;
break;
#include "cr-style.h"
#include "cr-prop-list.h"
-#ifdef CROCO_HAVE_LIBXML2
- #include <libxml/tree.h>
-#endif
-
-
+#include <libxml/tree.h>
/**
*@file:
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
g_return_val_if_fail (a_char_buf, NULL);
- parser = cr_parser_new_from_buf ((guchar*)a_char_buf, strlen (a_char_buf),
+ parser = cr_parser_new_from_buf ((guchar*)a_char_buf, strlen ((const char *) a_char_buf),
a_enc, FALSE);
g_return_val_if_fail (parser, NULL);
}
guchar *
-cr_selector_to_string (CRSelector * a_this)
+cr_selector_to_string (CRSelector const * a_this)
{
guchar *result = NULL;
GString *str_buf = NULL;
g_return_val_if_fail (str_buf, NULL);
if (a_this) {
- CRSelector *cur = NULL;
+ CRSelector const *cur = NULL;
for (cur = a_this; cur; cur = cur->next) {
if (cur->simple_sel) {
g_string_append (str_buf,
", ");
- g_string_append (str_buf, tmp_str);
+ g_string_append (str_buf, (const gchar *) tmp_str);
g_free (tmp_str);
tmp_str = NULL;
}
if (str_buf) {
- result = str_buf->str;
+ result = (guchar *) str_buf->str;
g_string_free (str_buf, FALSE);
str_buf = NULL;
}
*Serializes the current instance of #CRSelector to a file.
*/
void
-cr_selector_dump (CRSelector * a_this, FILE * a_fp)
+cr_selector_dump (CRSelector const * a_this, FILE * a_fp)
{
guchar *tmp_buf = NULL;
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
CRSelector* cr_selector_prepend (CRSelector *a_this, CRSelector *a_new) ;
-guchar * cr_selector_to_string (CRSelector *a_this) ;
+guchar * cr_selector_to_string (CRSelector const *a_this) ;
-void cr_selector_dump (CRSelector *a_this, FILE *a_fp) ;
+void cr_selector_dump (CRSelector const *a_this, FILE *a_fp) ;
void cr_selector_ref (CRSelector *a_this) ;
*
*@a_this: the this pointer of the current instance of #CRSimpleSel.
*@a_sel: the simple selector to append.
+ *
*Returns: the new list upon successfull completion, an error code otherwise.
*/
CRSimpleSel *
}
guchar *
-cr_simple_sel_to_string (CRSimpleSel * a_this)
+cr_simple_sel_to_string (CRSimpleSel const * a_this)
{
GString *str_buf = NULL;
guchar *result = NULL;
- CRSimpleSel *cur = NULL;
+ CRSimpleSel const *cur = NULL;
g_return_val_if_fail (a_this, NULL);
str_buf = g_string_new (NULL);
for (cur = a_this; cur; cur = cur->next) {
if (cur->name) {
- guchar *str = g_strndup (cur->name->stryng->str,
+ guchar *str = (guchar *) g_strndup (cur->name->stryng->str,
cur->name->stryng->len);
if (str) {
break;
}
- g_string_append (str_buf, str);
+ g_string_append (str_buf, (const gchar *) str);
g_free (str);
str = NULL;
}
tmp_str = cr_additional_sel_to_string (cur->add_sel);
if (tmp_str) {
- g_string_append (str_buf, tmp_str);
+ g_string_append (str_buf, (const gchar *) tmp_str);
g_free (tmp_str);
tmp_str = NULL;
}
}
if (str_buf) {
- result = str_buf->str;
+ result = (guchar *) str_buf->str;
g_string_free (str_buf, FALSE);
str_buf = NULL;
}
guchar *
-cr_simple_sel_one_to_string (CRSimpleSel * a_this)
+cr_simple_sel_one_to_string (CRSimpleSel const * a_this)
{
GString *str_buf = NULL;
guchar *result = NULL;
str_buf = g_string_new (NULL);
if (a_this->name) {
- guchar *str = g_strndup (a_this->name->stryng->str,
+ guchar *str = (guchar *) g_strndup (a_this->name->stryng->str,
a_this->name->stryng->len);
if (str) {
}
if (str_buf) {
- result = str_buf->str;
+ result = (guchar *) str_buf->str;
g_string_free (str_buf, FALSE);
str_buf = NULL;
}
*otherwise.
*/
enum CRStatus
-cr_simple_sel_dump (CRSimpleSel * a_this, FILE * a_fp)
+cr_simple_sel_dump (CRSimpleSel const * a_this, FILE * a_fp)
{
guchar *tmp_str = NULL;
enum CRStatus
cr_simple_sel_compute_specificity (CRSimpleSel * a_this)
{
- CRAdditionalSel *cur_add_sel = NULL;
- CRSimpleSel *cur_sel = NULL;
+ CRAdditionalSel const *cur_add_sel = NULL;
+ CRSimpleSel const *cur_sel = NULL;
gulong a = 0,
b = 0,
c = 0;
g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR);
for (cur_sel = a_this; cur_sel; cur_sel = cur_sel->next) {
- if (cur_sel->type_mask | TYPE_SELECTOR) {
+ if (cur_sel->type_mask & TYPE_SELECTOR) {
c++; /*hmmh, is this a new language ? */
} else if (!cur_sel->name
|| !cur_sel->name->stryng
CRSimpleSel * cr_simple_sel_prepend_simple_sel (CRSimpleSel *a_this,
CRSimpleSel *a_sel) ;
-guchar * cr_simple_sel_to_string (CRSimpleSel *a_this) ;
+guchar * cr_simple_sel_to_string (CRSimpleSel const *a_this) ;
-guchar * cr_simple_sel_one_to_string (CRSimpleSel * a_this) ;
+guchar * cr_simple_sel_one_to_string (CRSimpleSel const * a_this) ;
-enum CRStatus cr_simple_sel_dump (CRSimpleSel *a_this, FILE *a_fp) ;
+enum CRStatus cr_simple_sel_dump (CRSimpleSel const *a_this, FILE *a_fp) ;
-enum CRStatus cr_simple_sel_dump_attr_sel_list (CRSimpleSel *a_this) ;
+enum CRStatus cr_simple_sel_dump_attr_sel_list (CRSimpleSel const *a_this) ;
enum CRStatus cr_simple_sel_compute_specificity (CRSimpleSel *a_this) ;
*by the caller, using g_free().
*/
static gchar *
-cr_statement_ruleset_to_string (CRStatement * a_this, glong a_indent)
+cr_statement_ruleset_to_string (CRStatement const * a_this, glong a_indent)
{
GString *stringue = NULL;
gchar *tmp_str = NULL,
cr_utils_dump_n_chars2 (' ', stringue, a_indent);
tmp_str =
- cr_selector_to_string (a_this->kind.ruleset->
+ (gchar *) cr_selector_to_string (a_this->kind.ruleset->
sel_list);
if (tmp_str) {
g_string_append (stringue, tmp_str);
}
g_string_append (stringue, " {\n");
if (a_this->kind.ruleset->decl_list) {
- tmp_str = cr_declaration_list_to_string2
+ tmp_str = (gchar *) cr_declaration_list_to_string2
(a_this->kind.ruleset->decl_list,
a_indent + DECLARATION_INDENT_NB, TRUE);
if (tmp_str) {
*using g_free().
*/
static gchar *
-cr_statement_font_face_rule_to_string (CRStatement * a_this,
+cr_statement_font_face_rule_to_string (CRStatement const * a_this,
glong a_indent)
{
gchar *result = NULL, *tmp_str = NULL ;
cr_utils_dump_n_chars2 (' ', stringue,
a_indent);
g_string_append (stringue, "@font-face {\n");
- tmp_str = cr_declaration_list_to_string2
+ tmp_str = (gchar *) cr_declaration_list_to_string2
(a_this->kind.font_face_rule->decl_list,
a_indent + DECLARATION_INDENT_NB, TRUE) ;
if (tmp_str) {
/**
- * cr_statetement_charset_to_string:
+ * cr_statement_charset_to_string:
*
- *Serialises an @charset statement into a string.
+ *Serialises an \@charset statement into a string.
*@a_this: the statement to serialize.
*@a_indent: the number of indentation spaces
+ *
*Returns the serialized charset statement. Must be
*freed by the caller using g_free().
*/
static gchar *
-cr_statement_charset_to_string (CRStatement *a_this,
+cr_statement_charset_to_string (CRStatement const *a_this,
gulong a_indent)
{
gchar *str = NULL ;
*
*Serialises the at page rule statement into a string
*@a_this: the current instance of #CRStatement. Must
- *be an "@page" rule statement.
+ *be an "\@page" rule statement.
+ *
*Returns the serialized string. Must be freed by the caller
*/
static gchar *
-cr_statement_at_page_rule_to_string (CRStatement *a_this,
+cr_statement_at_page_rule_to_string (CRStatement const *a_this,
gulong a_indent)
{
GString *stringue = NULL;
if (a_this->kind.page_rule->decl_list) {
gchar *str = NULL ;
g_string_append (stringue, " {\n");
- str = cr_declaration_list_to_string2
+ str = (gchar *) cr_declaration_list_to_string2
(a_this->kind.page_rule->decl_list,
a_indent + DECLARATION_INDENT_NB, TRUE) ;
if (str) {
/**
- *Serializes an @media statement.
+ *Serializes an \@media statement.
*@param a_this the current instance of #CRStatement
*@param a_indent the number of spaces of indentation.
- *@return the serialized @media statement. Must be freed
+ *@return the serialized \@media statement. Must be freed
*by the caller using g_free().
*/
static gchar *
-cr_statement_media_rule_to_string (CRStatement *a_this,
+cr_statement_media_rule_to_string (CRStatement const *a_this,
gulong a_indent)
{
gchar *str = NULL ;
GString *stringue = NULL ;
- GList *cur = NULL;
+ GList const *cur = NULL;
g_return_val_if_fail (a_this->type == AT_MEDIA_RULE_STMT,
NULL);
for (cur = a_this->kind.media_rule->media_list; cur;
cur = cur->next) {
if (cur->data) {
- guchar *str = cr_string_dup2
- ((CRString *) cur->data);
+ gchar *str2 = cr_string_dup2
+ ((CRString const *) cur->data);
- if (str) {
+ if (str2) {
if (cur->prev) {
g_string_append
(stringue,
}
g_string_append_printf
(stringue,
- " %s", str);
- g_free (str);
- str = NULL;
+ " %s", str2);
+ g_free (str2);
+ str2 = NULL;
}
}
}
static gchar *
-cr_statement_import_rule_to_string (CRStatement *a_this,
+cr_statement_import_rule_to_string (CRStatement const *a_this,
gulong a_indent)
{
GString *stringue = NULL ;
- guchar *str = NULL;
+ gchar *str = NULL;
g_return_val_if_fail (a_this
&& a_this->type == AT_IMPORT_RULE_STMT
return NULL;
if (a_this->kind.import_rule->media_list) {
- GList *cur = NULL;
+ GList const *cur = NULL;
for (cur = a_this->kind.import_rule->media_list;
cur; cur = cur->next) {
if (cur->data) {
- CRString *crstr = cur->data;
+ CRString const *crstr = cur->data;
if (cur->prev) {
g_string_append
enum CRStatus status = CR_OK;
gboolean result = FALSE;
- parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf),
+ parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen ((const char *) a_buf),
a_encoding, FALSE);
g_return_val_if_fail (parser, FALSE);
*@a_encoding: the character encoding of a_buf.
*
*Parses a buffer that contains a css statement and returns
- *an instance of #CRStatement in case of successfull parsing.
- *TODO: at support of "@import" rules.
+ *an instance of #CRStatement in case of successful parsing.
+ *TODO: at support of "\@import" rules.
*
*Returns the newly built instance of #CRStatement in case
- *of successfull parsing, NULL otherwise.
+ *of successful parsing, NULL otherwise.
*/
CRStatement *
cr_statement_parse_from_buf (const guchar * a_buf, enum CREncoding a_encoding)
/*
*The strategy of this function is "brute force".
- *It tries to parse all the types of #CRStatement it knows about.
+ *It tries to parse all the types of CRStatement it knows about.
*I could do this a smarter way but I don't have the time now.
*I think I will revisit this when time of performances and
*pull based incremental parsing comes.
*Parses a buffer that contains a ruleset statement an instanciates
*a #CRStatement of type RULESET_STMT.
*
- *Returns the newly built instance of #CRStatement in case of successfull parsing,
+ *Returns the newly built instance of #CRStatement in case of successful parsing,
*NULL otherwise.
*/
CRStatement *
g_return_val_if_fail (a_buf, NULL);
- parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf),
+ parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen ((const char *) a_buf),
a_enc, FALSE);
g_return_val_if_fail (parser, NULL);
*@a_buf: the input to parse.
*@a_enc: the encoding of the buffer.
*
- *Parses a buffer that contains an "@media" declaration
- *and builds an @media css statement.
+ *Parses a buffer that contains an "\@media" declaration
+ *and builds an \@media css statement.
*
- *Returns the @media statement, or NULL if the buffer could not
+ *Returns the \@media statement, or NULL if the buffer could not
*be successfully parsed.
*/
CRStatement *
CRDocHandler *sac_handler = NULL;
enum CRStatus status = CR_OK;
- parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf),
+ parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen ((const char *) a_buf),
a_enc, FALSE);
if (!parser) {
- cr_utils_trace_info ("Instanciation of the parser failed");
+ cr_utils_trace_info ("Instantiation of the parser failed");
goto cleanup;
}
sac_handler = cr_doc_handler_new ();
if (!sac_handler) {
cr_utils_trace_info
- ("Instanciation of the sac handler failed");
+ ("Instantiation of the sac handler failed");
goto cleanup;
}
* cr_statement_new_at_media_rule:
*
*@a_ruleset: the ruleset statements contained
- *in the @media rule.
+ *in the \@media rule.
*@a_media: the media string list. A list of GString pointers.
*
*Instanciates an instance of #CRStatement of type
- *AT_MEDIA_RULE_STMT (@media ruleset).
+ *AT_MEDIA_RULE_STMT (\@media ruleset).
*
*/
CRStatement *
*@a_buf: the buffer to parse.
*@a_encoding: the encoding of a_buf.
*
- *Parses a buffer that contains an "@import" rule and
+ *Parses a buffer that contains an "\@import" rule and
*instanciate a #CRStatement of type AT_IMPORT_RULE_STMT
*
*Returns the newly built instance of #CRStatement in case of
- *a successfull parsing, NULL otherwise.
+ *a successful parsing, NULL otherwise.
*/
CRStatement *
cr_statement_at_import_rule_parse_from_buf (const guchar * a_buf,
CRString *import_string = NULL;
CRParsingLocation location = {0} ;
- parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf),
+ parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen ((const char *) a_buf),
a_encoding, FALSE);
if (!parser) {
- cr_utils_trace_info ("Instanciation of parser failed.");
+ cr_utils_trace_info ("Instantiation of parser failed.");
goto cleanup;
}
parser = NULL;
}
if (media_list) {
- GList *cur = NULL;
-
- for (cur = media_list; media_list;
+ for (; media_list;
media_list = g_list_next (media_list)) {
if (media_list->data) {
cr_string_destroy ((CRString*)media_list->data);
*@a_buf: the character buffer to parse.
*@a_encoding: the character encoding of a_buf.
*
- *Parses a buffer that contains an "@page" production and,
+ *Parses a buffer that contains an "\@page" production and,
*if the parsing succeeds, builds the page statement.
*
- *Returns the newly built at page statement in case of successfull parsing,
+ *Returns the newly built at page statement in case of successful parsing,
*NULL otherwise.
*/
CRStatement *
g_return_val_if_fail (a_buf, NULL);
- parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf),
+ parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen ((const char *) a_buf),
a_encoding, FALSE);
if (!parser) {
- cr_utils_trace_info ("Instanciation of the parser failed.");
+ cr_utils_trace_info ("Instantiation of the parser failed.");
goto cleanup;
}
sac_handler = cr_doc_handler_new ();
if (!sac_handler) {
cr_utils_trace_info
- ("Instanciation of the sac handler failed.");
+ ("Instantiation of the sac handler failed.");
goto cleanup;
}
*@a_buf: the buffer to parse.
*@a_encoding: the character encoding of the buffer.
*
- *Parses a buffer that contains an '@charset' rule and
+ *Parses a buffer that contains an '\@charset' rule and
*creates an instance of #CRStatement of type AT_CHARSET_RULE_STMT.
*
*Returns the newly built instance of #CRStatement.
g_return_val_if_fail (a_buf, NULL);
- parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf),
+ parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen ((const char *) a_buf),
a_encoding, FALSE);
if (!parser) {
- cr_utils_trace_info ("Instanciation of the parser failed.");
+ cr_utils_trace_info ("Instantiation of the parser failed.");
goto cleanup;
}
}
/**
- * cr_statemeent_new_at_font_face_rule:
+ * cr_statement_new_at_font_face_rule:
*
*@a_font_decls: a list of instances of #CRDeclaration. Each declaration
*is actually a font declaration.
*@a_buf: the buffer to parse.
*@a_encoding: the character encoding of a_buf.
*
- *Parses a buffer that contains an "@font-face" rule and builds
+ *Parses a buffer that contains an "\@font-face" rule and builds
*an instance of #CRStatement of type AT_FONT_FACE_RULE_STMT out of it.
*
*Returns the newly built instance of #CRStatement in case of successufull
CRDocHandler *sac_handler = NULL;
enum CRStatus status = CR_OK;
- parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf),
+ parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen ((const char *) a_buf),
a_encoding, FALSE);
if (!parser)
goto cleanup;
*
*Sets the container stylesheet.
*
- *Returns CR_OK upon successfull completion, an errror code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_set_parent_sheet (CRStatement * a_this, CRStyleSheet * a_sheet)
*
*Gets the sheets that contains the current statement.
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_get_parent_sheet (CRStatement * a_this, CRStyleSheet ** a_sheet)
*
*@a_this: the current statements list.
*@a_to_unlink: the statement to unlink from the list.
- *Returns the new list where a_to_unlink has been unlinked
*
*Unlinks a statement from the statements list.
*
+ *Returns the new list where a_to_unlink has been unlinked
*from, or NULL in case of error.
*/
CRStatement *
*Returns number of rules in the statement list.
*/
gint
-cr_statement_nr_rules (CRStatement * a_this)
+cr_statement_nr_rules (CRStatement const * a_this)
{
- CRStatement *cur = NULL;
+ CRStatement const *cur = NULL;
int nr = 0;
g_return_val_if_fail (a_this, -1);
*
*Sets a selector list to a ruleset statement.
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_ruleset_set_sel_list (CRStatement * a_this,
*Gets a pointer to the list of declaration contained
*in the ruleset statement.
*
- *Returns CR_OK upon successfull completion, an error code if something
+ *Returns CR_OK upon successful completion, an error code if something
*bad happened.
*/
enum CRStatus
}
/**
- * cr_statement_get_sel_list:
+ * cr_statement_ruleset_get_sel_list:
*
*@a_this: the current ruleset statement.
*@a_list: out parameter. The returned selector list,
*Gets a pointer to the selector list contained in
*the current ruleset statement.
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_statement_ruleset_get_sel_list (CRStatement * a_this, CRSelector ** a_list)
+cr_statement_ruleset_get_sel_list (CRStatement const * a_this, CRSelector ** a_list)
{
g_return_val_if_fail (a_this && a_this->type == RULESET_STMT
&& a_this->kind.ruleset, CR_BAD_PARAM_ERROR);
}
/**
- * cr_statement_ruleset_sel_decl_list:
+ * cr_statement_ruleset_set_decl_list:
*
*@a_this: the current ruleset statement.
*@a_list: the declaration list to be added to the current
*
*Sets a declaration list to the current ruleset statement.
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_ruleset_set_decl_list (CRStatement * a_this,
*
*Appends a declaration to the current ruleset statement.
*
- *@Returns CR_OK uppon successfull completion, an error code
+ *Returns CR_OK upon successful completion, an error code
*otherwise.
*/
enum CRStatus
*
*@a_this: the current statement.
*@a_declaration: the declaration to append.
- *Returns CR_OK upon sucessfull completion, an error code
+ *
+ *Returns CR_OK upon sucessful completion, an error code
*otherwise.
*/
enum CRStatus
}
/**
- * cr_statement_ruleset_append_decl:
+ * cr_statement_at_import_rule_set_imported_sheet:
*
- *Sets a stylesheet to the current @import rule.
- *@a_this: the current @import rule.
+ *Sets a stylesheet to the current \@import rule.
+ *@a_this: the current \@import rule.
*@a_sheet: the stylesheet. The stylesheet is owned
*by the current instance of #CRStatement, that is, the
*stylesheet will be destroyed when the current instance
- *of #CRStatement will be destroyed.
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *of #CRStatement is destroyed.
+ *
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_import_rule_set_imported_sheet (CRStatement * a_this,
}
/**
- * cr_statement_at_import_rule_get_importe_sheet:
+ * cr_statement_at_import_rule_get_imported_sheet:
*
- *@a_this: the current @import rule statement.
+ *@a_this: the current \@import rule statement.
*@a_sheet: out parameter. The returned stylesheet if and
*only if the function returns CR_OK.
*
- *Gets the stylesheet contained by the @import rule statement.
- *Returns CR_OK upon sucessfull completion, an error code otherwise.
+ *Gets the stylesheet contained by the \@import rule statement.
+ *Returns CR_OK upon sucessful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_import_rule_get_imported_sheet (CRStatement * a_this,
/**
* cr_statement_at_import_rule_set_url:
*
- *@a_this: the current @import rule statement.
+ *@a_this: the current \@import rule statement.
*@a_url: the url to set.
*
- *Sets an url to the current @import rule statement.
+ *Sets an url to the current \@import rule statement.
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_import_rule_set_url (CRStatement * a_this,
/**
* cr_statement_at_import_rule_get_url:
*
- *@a_this: the current @import rule statement.
+ *@a_this: the current \@import rule statement.
*@a_url: out parameter. The returned url if
*and only if the function returned CR_OK.
*
- *Gets the url of the @import rule statement.
+ *Gets the url of the \@import rule statement.
*Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_statement_at_import_rule_get_url (CRStatement * a_this,
+cr_statement_at_import_rule_get_url (CRStatement const * a_this,
CRString ** a_url)
{
g_return_val_if_fail (a_this
* cr_statement_at_media_nr_rules:
*
*@a_this: the current instance of #CRStatement.
+ *
*Returns the number of rules in the media rule;
*/
int
-cr_statement_at_media_nr_rules (CRStatement * a_this)
+cr_statement_at_media_nr_rules (CRStatement const * a_this)
{
g_return_val_if_fail (a_this
&& a_this->type == AT_MEDIA_RULE_STMT
}
/**
- * cr_statement_at_page_rule_get_declarations:
+ * cr_statement_at_page_rule_set_declarations:
*
- *@a_this: the current @page rule statement.
+ *@a_this: the current \@page rule statement.
*@a_decl_list: the declaration list to add. Will be freed
*by the current instance of #CRStatement when it is destroyed.
*
- *Sets a declaration list to the current @page rule statement.
+ *Sets a declaration list to the current \@page rule statement.
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_page_rule_set_declarations (CRStatement * a_this,
}
/**
- * cr_statemenet_at_page_rule_get_declarations:
+ * cr_statement_at_page_rule_get_declarations:
*
- *@a_this: the current @page rule statement.
+ *@a_this: the current \@page rule statement.
*@a_decl_list: out parameter. The returned declaration list.
*
- *Gets the declaration list associated to the current @page rule
+ *Gets the declaration list associated to the current \@page rule
*statement.
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_page_rule_get_declarations (CRStatement * a_this,
* cr_statement_at_charset_rule_set_charset:
*
*
- *@a_this: the current @charset rule statement.
+ *@a_this: the current \@charset rule statement.
*@a_charset: the charset to set.
*
- *Sets the charset of the current @charset rule statement.
+ *Sets the charset of the current \@charset rule statement.
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_charset_rule_set_charset (CRStatement * a_this,
/**
* cr_statement_at_charset_rule_get_charset:
- *@a_this: the current @charset rule statement.
+ *@a_this: the current \@charset rule statement.
*@a_charset: out parameter. The returned charset string if
*and only if the function returned CR_OK.
*
*Gets the charset string associated to the current
- *@charset rule statement.
+ *\@charset rule statement.
*
* Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_statement_at_charset_rule_get_charset (CRStatement * a_this,
+cr_statement_at_charset_rule_get_charset (CRStatement const * a_this,
CRString ** a_charset)
{
g_return_val_if_fail (a_this
/**
* cr_statement_at_font_face_rule_set_decls:
*
- *@a_this: the current @font-face rule statement.
+ *@a_this: the current \@font-face rule statement.
*@a_decls: the declarations list to set.
*
- *Sets a declaration list to the current @font-face rule statement.
+ *Sets a declaration list to the current \@font-face rule statement.
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_font_face_rule_set_decls (CRStatement * a_this,
}
/**
- * cr_statement_at_fot_face_rule_set_decls:
+ * cr_statement_at_font_face_rule_get_decls:
*
- *@a_this: the current @font-face rule statement.
+ *@a_this: the current \@font-face rule statement.
*@a_decls: out parameter. The returned declaration list if
*and only if this function returns CR_OK.
*
*Gets the declaration list associated to the current instance
- *of @font-face rule statement.
+ *of \@font-face rule statement.
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_font_face_rule_get_decls (CRStatement * a_this,
/**
* cr_statement_at_font_face_rule_add_decl:
*
- *@a_this: the current @font-face rule statement.
+ *@a_this: the current \@font-face rule statement.
*@a_prop: the property of the declaration.
*@a_value: the value of the declaration.
*
- *Adds a declaration to the current @font-face rule
+ *Adds a declaration to the current \@font-face rule
*statement.
*
- *Returns CR_OK upon successfull completion, an error code otherwise.
+ *Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
cr_statement_at_font_face_rule_add_decl (CRStatement * a_this,
*using g_free().
*/
gchar *
-cr_statement_to_string (CRStatement * a_this, gulong a_indent)
+cr_statement_to_string (CRStatement const * a_this, gulong a_indent)
{
gchar *str = NULL ;
}
gchar*
-cr_statement_list_to_string (CRStatement *a_this, gulong a_indent)
+cr_statement_list_to_string (CRStatement const *a_this, gulong a_indent)
{
- CRStatement *cur_stmt = NULL ;
+ CRStatement const *cur_stmt = NULL ;
GString *stringue = NULL ;
gchar *str = NULL ;
*Dumps the css2 statement to a file.
*/
void
-cr_statement_dump (CRStatement * a_this, FILE * a_fp, gulong a_indent)
+cr_statement_dump (CRStatement const * a_this, FILE * a_fp, gulong a_indent)
{
gchar *str = NULL ;
*Dumps a ruleset statement to a file.
*/
void
-cr_statement_dump_ruleset (CRStatement * a_this, FILE * a_fp, glong a_indent)
+cr_statement_dump_ruleset (CRStatement const * a_this, FILE * a_fp, glong a_indent)
{
- guchar *str = NULL;
+ gchar *str = NULL;
g_return_if_fail (a_fp && a_this);
str = cr_statement_ruleset_to_string (a_this, a_indent);
if (str) {
- fprintf (a_fp, str);
+ fprintf (a_fp, "%s", str);
g_free (str);
str = NULL;
}
*Dumps a font face rule statement to a file.
*/
void
-cr_statement_dump_font_face_rule (CRStatement * a_this, FILE * a_fp,
+cr_statement_dump_font_face_rule (CRStatement const * a_this, FILE * a_fp,
glong a_indent)
{
gchar *str = NULL ;
/**
* cr_statement_dump_charset:
*
- *@a_this: the current instance of the @charset rule statement.
+ *@a_this: the current instance of the \@charset rule statement.
*@a_fp: the destination file pointer.
*@a_indent: the number of indentation white spaces.
*
- *Dumps an @charset rule statement to a file.
+ *Dumps an \@charset rule statement to a file.
*/
void
-cr_statement_dump_charset (CRStatement * a_this, FILE * a_fp, gulong a_indent)
+cr_statement_dump_charset (CRStatement const * a_this, FILE * a_fp, gulong a_indent)
{
- guchar *str = NULL;
+ gchar *str = NULL;
g_return_if_fail (a_this && a_this->type == AT_CHARSET_RULE_STMT);
str = cr_statement_charset_to_string (a_this,
a_indent) ;
if (str) {
- fprintf (a_fp, str) ;
+ fprintf (a_fp, "%s", str) ;
g_free (str) ;
str = NULL ;
}
*@a_fp: the destination file pointer.
*@a_indent: the number of indentation white spaces.
*
- *Dumps an @page rule statement on stdout.
+ *Dumps an \@page rule statement on stdout.
*/
void
-cr_statement_dump_page (CRStatement * a_this, FILE * a_fp, gulong a_indent)
+cr_statement_dump_page (CRStatement const * a_this, FILE * a_fp, gulong a_indent)
{
- guchar *str = NULL;
+ gchar *str = NULL;
g_return_if_fail (a_this
&& a_this->type == AT_PAGE_RULE_STMT
str = cr_statement_at_page_rule_to_string (a_this, a_indent) ;
if (str) {
- fprintf (a_fp, str);
+ fprintf (a_fp, "%s", str);
g_free (str) ;
str = NULL ;
}
*@a_fp: the destination file pointer
*@a_indent: the number of white spaces indentation.
*
- *Dumps an @media rule statement to a file.
+ *Dumps an \@media rule statement to a file.
*/
void
-cr_statement_dump_media_rule (CRStatement * a_this,
+cr_statement_dump_media_rule (CRStatement const * a_this,
FILE * a_fp,
gulong a_indent)
{
str = cr_statement_media_rule_to_string (a_this, a_indent) ;
if (str) {
- fprintf (a_fp, str) ;
+ fprintf (a_fp, "%s", str) ;
g_free (str) ;
str = NULL ;
}
*@a_fp: the destination file pointer.
*@a_indent: the number of white space indentations.
*
- *Dumps an @import rule statement to a file.
+ *Dumps an \@import rule statement to a file.
*/
void
-cr_statement_dump_import_rule (CRStatement * a_this, FILE * a_fp,
+cr_statement_dump_import_rule (CRStatement const * a_this, FILE * a_fp,
gulong a_indent)
{
gchar *str = NULL ;
str = cr_statement_import_rule_to_string (a_this, a_indent) ;
if (str) {
- fprintf (a_fp, str) ;
+ fprintf (a_fp, "%s", str) ;
g_free (str) ;
str = NULL ;
}
* cr_statement_destroy:
*
* @a_this: the current instance of #CRStatement.
+ *
*Destructor of #CRStatement.
*/
void
typedef struct _CRStyleSheet CRStyleSheet;
-/**The @import rule abstraction.*/
+/**The \@import rule abstraction.*/
typedef struct _CRAtImportRule CRAtImportRule ;
struct _CRAtImportRule
{
};
-/**abstraction of an @media rule*/
+/**abstraction of an \@media rule*/
struct _CRAtMediaRule
{
GList *media_list ;
typedef struct _CRAtPageRule CRAtPageRule ;
-/**The @page rule abstraction*/
+/**The \@page rule abstraction*/
struct _CRAtPageRule
{
/**a list of instances of #CRDeclaration*/
CRString *pseudo ;
} ;
-/**The @charset rule abstraction*/
+/**The \@charset rule abstraction*/
typedef struct _CRAtCharsetRule CRAtCharsetRule ;
struct _CRAtCharsetRule
{
CRString * charset ;
};
-/**The abstaction of the @font-face rule.*/
+/**The abstaction of the \@font-face rule.*/
typedef struct _CRAtFontFaceRule CRAtFontFaceRule ;
struct _CRAtFontFaceRule
{
CRSelector *a_sel_list) ;
enum CRStatus
-cr_statement_ruleset_get_sel_list (CRStatement *a_this,
+cr_statement_ruleset_get_sel_list (CRStatement const *a_this,
CRSelector **a_list) ;
enum CRStatus
CRString *a_url) ;
enum CRStatus
-cr_statement_at_import_rule_get_url (CRStatement *a_this,
+cr_statement_at_import_rule_get_url (CRStatement const *a_this,
CRString **a_url) ;
gint
-cr_statement_at_media_nr_rules (CRStatement *a_this) ;
+cr_statement_at_media_nr_rules (CRStatement const *a_this) ;
CRStatement *
cr_statement_at_media_get_from_list (CRStatement *a_this, int itemnr) ;
CRSelector *a_sel) ;
enum CRStatus
-cr_statement_at_page_rule_get_sel (CRStatement *a_this,
+cr_statement_at_page_rule_get_sel (CRStatement const *a_this,
CRSelector **a_sel) ;
enum CRStatus
CRString *a_charset) ;
enum CRStatus
-cr_statement_at_charset_rule_get_charset (CRStatement *a_this,
+cr_statement_at_charset_rule_get_charset (CRStatement const *a_this,
CRString **a_charset) ;
enum CRStatus
CRTerm *a_value) ;
gchar *
-cr_statement_to_string (CRStatement * a_this, gulong a_indent) ;
+cr_statement_to_string (CRStatement const * a_this, gulong a_indent) ;
gchar*
-cr_statement_list_to_string (CRStatement *a_this, gulong a_indent) ;
+cr_statement_list_to_string (CRStatement const *a_this, gulong a_indent) ;
void
-cr_statement_dump (CRStatement *a_this, FILE *a_fp, gulong a_indent) ;
+cr_statement_dump (CRStatement const *a_this, FILE *a_fp, gulong a_indent) ;
void
-cr_statement_dump_ruleset (CRStatement * a_this, FILE * a_fp,
+cr_statement_dump_ruleset (CRStatement const * a_this, FILE * a_fp,
glong a_indent) ;
void
-cr_statement_dump_font_face_rule (CRStatement * a_this,
+cr_statement_dump_font_face_rule (CRStatement const * a_this,
FILE * a_fp,
glong a_indent) ;
void
-cr_statement_dump_page (CRStatement * a_this, FILE * a_fp,
+cr_statement_dump_page (CRStatement const * a_this, FILE * a_fp,
gulong a_indent) ;
void
-cr_statement_dump_media_rule (CRStatement * a_this,
+cr_statement_dump_media_rule (CRStatement const * a_this,
FILE * a_fp,
gulong a_indent) ;
void
-cr_statement_dump_import_rule (CRStatement * a_this, FILE * a_fp,
+cr_statement_dump_import_rule (CRStatement const * a_this, FILE * a_fp,
gulong a_indent) ;
void
-cr_statement_dump_charset (CRStatement * a_this, FILE * a_fp,
+cr_statement_dump_charset (CRStatement const * a_this, FILE * a_fp,
gulong a_indent) ;
gint
-cr_statement_nr_rules (CRStatement *a_this) ;
+cr_statement_nr_rules (CRStatement const *a_this) ;
CRStatement *
cr_statement_get_from_list (CRStatement *a_this, int itemnr) ;
*@return the newly instanciated #CRString.
*/
CRString *
-cr_string_new_from_gstring (GString *a_string)
+cr_string_new_from_gstring (GString const *a_string)
{
CRString *result = NULL ;
return NULL ;
}
if (a_string) {
- result->stryng = g_string_new_len
- (a_string->str, a_string->len) ;
- } else {
- result->stryng = g_string_new (NULL) ;
+ g_string_append_len (result->stryng,
+ a_string->str,
+ a_string->len);
+
}
return result ;
}
CRString *
-cr_string_dup (CRString *a_this)
+cr_string_dup (CRString const *a_this)
{
CRString *result = NULL ;
g_return_val_if_fail (a_this, NULL) ;
}
gchar *
-cr_string_dup2 (CRString *a_this)
+cr_string_dup2 (CRString const *a_this)
{
gchar *result = NULL ;
*@param a_this the current instance of #CRString
*/
const gchar *
-cr_string_peek_raw_str (CRString *a_this)
+cr_string_peek_raw_str (CRString const *a_this)
{
g_return_val_if_fail (a_this, NULL) ;
*of -1 if no length can be returned.
*/
gint
-cr_string_peek_raw_str_len (CRString *a_this)
+cr_string_peek_raw_str_len (CRString const *a_this)
{
g_return_val_if_fail (a_this && a_this->stryng,
-1) ;
CRString * cr_string_new (void) ;
CRString *cr_string_new_from_string (const gchar * a_string) ;
-CRString * cr_string_new_from_gstring (GString *a_string) ;
-CRString *cr_string_dup (CRString *a_this) ;
-gchar *cr_string_dup2 (CRString *a_this) ;
-const gchar *cr_string_peek_raw_str (CRString *a_this) ;
-gint cr_string_peek_raw_str_len (CRString *a_this) ;
+CRString * cr_string_new_from_gstring (GString const *a_string) ;
+CRString *cr_string_dup (CRString const *a_this) ;
+gchar *cr_string_dup2 (CRString const *a_this) ;
+const gchar *cr_string_peek_raw_str (CRString const *a_this) ;
+gint cr_string_peek_raw_str_len (CRString const *a_this) ;
void cr_string_destroy (CRString *a_this) ;
G_END_DECLS
typedef struct _CRPropertyDesc CRPropertyDesc;
struct _CRPropertyDesc {
- const guchar *name;
+ const gchar *name;
enum CRPropertyID prop_id;
};
static const gchar *
num_prop_code_to_string (enum CRNumProp a_code)
{
- gint len = sizeof (gv_num_props_dump_infos) /
+ guint len = sizeof (gv_num_props_dump_infos) /
sizeof (struct CRNumPropEnumDumpInfo);
if (a_code >= len) {
cr_utils_trace_info ("A field has been added "
static const gchar *
rgb_prop_code_to_string (enum CRRgbProp a_code)
{
- gint len = sizeof (gv_rgb_props_dump_infos) /
+ guint len = sizeof (gv_rgb_props_dump_infos) /
sizeof (struct CRRgbPropEnumDumpInfo);
if (a_code >= len) {
static const gchar *
border_style_prop_code_to_string (enum CRBorderStyleProp a_code)
{
- gint len = sizeof (gv_border_style_props_dump_infos) /
+ guint len = sizeof (gv_border_style_props_dump_infos) /
sizeof (struct CRBorderStylePropEnumDumpInfo);
if (a_code >= len) {
if (a_value->content.str
&& a_value->content.str->stryng
&& a_value->content.str->stryng->str
- && !strncmp ((guchar *) "inherit",
+ && !strncmp ((const char *) "inherit",
a_value->content.str->stryng->str,
sizeof ("inherit")-1)) {
status = cr_num_set (num_val, 0.0, NUM_INHERIT);
}
struct CRPropDisplayValPair {
- const guchar *prop_name;
+ const gchar *prop_name;
enum CRDisplayType type;
};
}
struct CRPropPositionValPair {
- const guchar *name;
+ const gchar *name;
enum CRPositionType type;
};
break;
}
- return CR_OK;
+ return status;
}
static enum CRStatus
|| !a_value->content.str
|| !a_value->content.str->stryng
|| !a_value->content.str->stryng->str) {
- /*unknow type, the float type is set to it's default value */
+ /*unknown type, the float type is set to it's default value */
return CR_OK;
}
&& a_value->content.str->stryng->str) {
status = cr_rgb_set_from_name
(rgb_color,
- a_value->content.str->stryng->str);
+ (const guchar *) a_value->content.str->stryng->str);
}
if (status != CR_OK) {
- cr_rgb_set_from_name (rgb_color, "black");
+ cr_rgb_set_from_name (rgb_color, (const guchar *) "black");
}
} else if (a_value->type == TERM_RGB) {
if (a_value->content.rgb) {
&& cur_term->content.str->stryng->str) {
cur_ff = cr_font_family_new
(FONT_FAMILY_NON_GENERIC,
- cur_term->content.str->stryng->str);
+ (guchar *) cur_term->content.str->stryng->str);
}
}
break;
a_style->font_size.sv.type = INHERITED_FONT_SIZE;
} else {
- cr_utils_trace_info ("Unknow value of font-size") ;
+ cr_utils_trace_info ("Unknown value of font-size") ;
status = init_style_font_size_field (a_style);
return CR_UNKNOWN_PROP_VAL_ERROR;
}
a_style->white_space = WHITE_SPACE_NORMAL;
} else if (!strcmp (a_value->content.str->stryng->str,
"pre")) {
- a_style->font_weight = WHITE_SPACE_PRE;
+ a_style->white_space = WHITE_SPACE_PRE;
} else if (!strcmp (a_value->content.str->stryng->str,
"nowrap")) {
a_style->white_space = WHITE_SPACE_NOWRAP;
CR_BAD_PARAM_ERROR);
prop_id = cr_style_get_prop_id
- (a_decl->property->stryng->str);
+ ((const guchar *) a_decl->property->stryng->str);
value = a_decl->value;
switch (prop_id) {
str = (gchar *) "inherited";
break;
default:
- str = (gchar *) "unknow white space property value";
+ str = (gchar *) "unknown white space property value";
break;
}
cr_utils_dump_n_chars2 (' ', a_str, a_nb_indent);
cr_utils_dump_n_chars2 (' ', str, indent);
g_string_append (str, "font-family: ");
- tmp_str = cr_font_family_to_string (a_this->font_family, TRUE);
+ tmp_str = (gchar *) cr_font_family_to_string (a_this->font_family, TRUE);
if (tmp_str) {
g_string_append (str, tmp_str);
g_free (tmp_str);
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
*@return the serialized stylesheet.
*/
gchar *
-cr_stylesheet_to_string (CRStyleSheet *a_this)
+cr_stylesheet_to_string (CRStyleSheet const *a_this)
{
gchar *str = NULL;
GString *stringue = NULL;
- CRStatement *cur_stmt = NULL;
+ CRStatement const *cur_stmt = NULL;
g_return_val_if_fail (a_this, NULL);
*@param a_fp the destination file
*/
void
-cr_stylesheet_dump (CRStyleSheet * a_this, FILE * a_fp)
+cr_stylesheet_dump (CRStyleSheet const * a_this, FILE * a_fp)
{
gchar *str = NULL ;
*@return number of rules in the stylesheet.
*/
gint
-cr_stylesheet_nr_rules (CRStyleSheet * a_this)
+cr_stylesheet_nr_rules (CRStyleSheet const * a_this)
{
g_return_val_if_fail (a_this, -1);
CRStyleSheet * cr_stylesheet_new (CRStatement *a_stmts) ;
-gchar * cr_stylesheet_to_string (CRStyleSheet *a_this) ;
-void cr_stylesheet_dump (CRStyleSheet *a_this, FILE *a_fp) ;
+gchar * cr_stylesheet_to_string (CRStyleSheet const *a_this) ;
+void cr_stylesheet_dump (CRStyleSheet const *a_this, FILE *a_fp) ;
-gint cr_stylesheet_nr_rules (CRStyleSheet *a_this) ;
+gint cr_stylesheet_nr_rules (CRStyleSheet const *a_this) ;
CRStatement * cr_stylesheet_statement_get_from_list (CRStyleSheet *a_this, int itemnr) ;
g_return_val_if_fail (a_buf, NULL);
- parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen (a_buf),
+ parser = cr_parser_new_from_buf ((guchar*)a_buf, strlen ((const char *) a_buf),
a_encoding, FALSE);
g_return_val_if_fail (parser, NULL);
*form of #CRTerm. MUST BE FREED BY THE CALLER using g_free().
*/
guchar *
-cr_term_to_string (CRTerm * a_this)
+cr_term_to_string (CRTerm const * a_this)
{
GString *str_buf = NULL;
- CRTerm *cur = NULL;
+ CRTerm const *cur = NULL;
guchar *result = NULL,
*content = NULL;
}
if (content) {
- g_string_append (str_buf, content);
+ g_string_append (str_buf, (const gchar *) content);
g_free (content);
content = NULL;
}
case TERM_FUNCTION:
if (cur->content.str) {
- content = g_strndup
+ content = (guchar *) g_strndup
(cur->content.str->stryng->str,
cur->content.str->stryng->len);
}
if (tmp_str) {
g_string_append (str_buf,
- tmp_str);
+ (const gchar *) tmp_str);
g_free (tmp_str);
tmp_str = NULL;
}
-
- g_free (content);
- content = NULL;
}
g_string_append (str_buf, ")");
+ g_free (content);
+ content = NULL;
}
break;
case TERM_STRING:
if (cur->content.str) {
- content = g_strndup
+ content = (guchar *) g_strndup
(cur->content.str->stryng->str,
cur->content.str->stryng->len);
}
case TERM_IDENT:
if (cur->content.str) {
- content = g_strndup
+ content = (guchar *) g_strndup
(cur->content.str->stryng->str,
cur->content.str->stryng->len);
}
if (content) {
- g_string_append (str_buf, content);
+ g_string_append (str_buf, (const gchar *) content);
g_free (content);
content = NULL;
}
case TERM_URI:
if (cur->content.str) {
- content = g_strndup
+ content = (guchar *) g_strndup
(cur->content.str->stryng->str,
cur->content.str->stryng->len);
}
tmp_str = cr_rgb_to_string (cur->content.rgb);
if (tmp_str) {
- g_string_append (str_buf, tmp_str);
+ g_string_append (str_buf, (const gchar *) tmp_str);
g_free (tmp_str);
tmp_str = NULL;
}
case TERM_HASH:
if (cur->content.str) {
- content = g_strndup
+ content = (guchar *) g_strndup
(cur->content.str->stryng->str,
cur->content.str->stryng->len);
}
}
if (str_buf) {
- result = str_buf->str;
+ result =(guchar *) str_buf->str;
g_string_free (str_buf, FALSE);
str_buf = NULL;
}
}
guchar *
-cr_term_one_to_string (CRTerm * a_this)
+cr_term_one_to_string (CRTerm const * a_this)
{
GString *str_buf = NULL;
guchar *result = NULL,
}
if (content) {
- g_string_append (str_buf, content);
+ g_string_append (str_buf, (const gchar *) content);
g_free (content);
content = NULL;
}
case TERM_FUNCTION:
if (a_this->content.str) {
- content = g_strndup
+ content = (guchar *) g_strndup
(a_this->content.str->stryng->str,
a_this->content.str->stryng->len);
}
case TERM_STRING:
if (a_this->content.str) {
- content = g_strndup
+ content = (guchar *) g_strndup
(a_this->content.str->stryng->str,
a_this->content.str->stryng->len);
}
case TERM_IDENT:
if (a_this->content.str) {
- content = g_strndup
+ content = (guchar *) g_strndup
(a_this->content.str->stryng->str,
a_this->content.str->stryng->len);
}
if (content) {
- g_string_append (str_buf, content);
+ g_string_append (str_buf, (const gchar *) content);
g_free (content);
content = NULL;
}
case TERM_URI:
if (a_this->content.str) {
- content = g_strndup
+ content = (guchar *) g_strndup
(a_this->content.str->stryng->str,
a_this->content.str->stryng->len);
}
tmp_str = cr_rgb_to_string (a_this->content.rgb);
if (tmp_str) {
- g_string_append (str_buf, tmp_str);
+ g_string_append (str_buf, (const gchar *) tmp_str);
g_free (tmp_str);
tmp_str = NULL;
}
case TERM_HASH:
if (a_this->content.str) {
- content = g_strndup
+ content = (guchar *) g_strndup
(a_this->content.str->stryng->str,
a_this->content.str->stryng->len);
}
}
if (str_buf) {
- result = str_buf->str;
+ result = (guchar *) str_buf->str;
g_string_free (str_buf, FALSE);
str_buf = NULL;
}
*@param a_fp the destination file pointer.
*/
void
-cr_term_dump (CRTerm * a_this, FILE * a_fp)
+cr_term_dump (CRTerm const * a_this, FILE * a_fp)
{
guchar *content = NULL;
*@return number of terms in the expression.
*/
int
-cr_term_nr_values (CRTerm *a_this)
+cr_term_nr_values (CRTerm const *a_this)
{
- CRTerm *cur = NULL ;
+ CRTerm const *cur = NULL ;
int nr = 0;
g_return_val_if_fail (a_this, -1) ;
CRTerm * cr_term_prepend_term (CRTerm *a_this, CRTerm *a_new_term) ;
-guchar * cr_term_to_string (CRTerm *a_this) ;
+guchar * cr_term_to_string (CRTerm const *a_this) ;
-guchar * cr_term_one_to_string (CRTerm * a_this) ;
+guchar * cr_term_one_to_string (CRTerm const * a_this) ;
-void cr_term_dump (CRTerm *a_this, FILE *a_fp) ;
+void cr_term_dump (CRTerm const *a_this, FILE *a_fp) ;
-int cr_term_nr_values (CRTerm *a_this) ;
+int cr_term_nr_values (CRTerm const *a_this) ;
CRTerm * cr_term_get_from_list (CRTerm *a_this, int itemnr) ;
*/
#define SKIP_CHARS(a_tknzr, a_nb_chars) \
{ \
-glong nb_chars = a_nb_chars ; \
+gulong nb_chars = a_nb_chars ; \
status = cr_input_consume_chars \
(PRIVATE (a_tknzr)->input,0, &nb_chars) ; \
CHECK_PARSING_STATUS (status, TRUE) ; \
status = cr_tknzr_peek_char (a_this, &cur_char);
if (status == CR_END_OF_INPUT_ERROR) {
- status = CR_OK;
break;
} else if (status != CR_OK) {
goto error;
}
if (cr_utils_is_white_space (cur_char) == TRUE) {
- glong nb_chars = -1; /*consume all spaces */
+ gulong nb_chars = -1; /*consume all spaces */
status = cr_input_consume_white_spaces
(PRIVATE (a_this)->input, &nb_chars);
READ_NEXT_CHAR (a_this, &cur_char);
ENSURE_PARSING_COND (cur_char == '*');
comment = cr_string_new ();
- for (;;) {
+ for (;;) { /* [^*]* */
+ PEEK_NEXT_CHAR (a_this, &next_char);
+ if (next_char == '*')
+ break;
READ_NEXT_CHAR (a_this, &cur_char);
-
- /*make sure there are no nested comments */
- if (cur_char == '/') {
+ g_string_append_unichar (comment->stryng, cur_char);
+ }
+ /* Stop condition: next_char == '*' */
+ for (;;) { /* \*+ */
+ READ_NEXT_CHAR(a_this, &cur_char);
+ ENSURE_PARSING_COND (cur_char == '*');
+ g_string_append_unichar (comment->stryng, cur_char);
+ PEEK_NEXT_CHAR (a_this, &next_char);
+ if (next_char != '*')
+ break;
+ }
+ /* Stop condition: next_char != '*' */
+ for (;;) { /* ([^/][^*]*\*+)* */
+ if (next_char == '/')
+ break;
+ READ_NEXT_CHAR(a_this, &cur_char);
+ g_string_append_unichar (comment->stryng, cur_char);
+ for (;;) { /* [^*]* */
+ PEEK_NEXT_CHAR (a_this, &next_char);
+ if (next_char == '*')
+ break;
READ_NEXT_CHAR (a_this, &cur_char);
- ENSURE_PARSING_COND (cur_char != '*');
- g_string_append_c (comment->stryng, '/');
- g_string_append_unichar (comment->stryng,
- cur_char);
- continue;
+ g_string_append_unichar (comment->stryng, cur_char);
}
-
- /*Detect the end of the comments region */
- if (cur_char == '*') {
+ /* Stop condition: next_char = '*', no need to verify, because peek and read exit to error anyway */
+ for (;;) { /* \*+ */
+ READ_NEXT_CHAR(a_this, &cur_char);
+ ENSURE_PARSING_COND (cur_char == '*');
+ g_string_append_unichar (comment->stryng, cur_char);
PEEK_NEXT_CHAR (a_this, &next_char);
-
- if (next_char == '/') {
- /*
- *end of comments region
- *Now, call the right SAC callback.
- */
- SKIP_CHARS (a_this, 1) ;
- status = CR_OK;
+ if (next_char != '*')
break;
- } else {
- g_string_append_c (comment->stryng,
- '*');
- }
}
- g_string_append_unichar (comment->stryng, cur_char);
+ /* Continue condition: next_char != '*' */
}
+ /* Stop condition: next_char == '\/' */
+ READ_NEXT_CHAR(a_this, &cur_char);
+ g_string_append_unichar (comment->stryng, cur_char);
if (status == CR_OK) {
cr_parsing_location_copy (&comment->location,
*Error code can be either CR_PARSING_ERROR if the string
*parsed just doesn't
*respect the production or another error if a
- *lower level error occured.
+ *lower level error occurred.
*/
static enum CRStatus
cr_tknzr_parse_unicode_escape (CRTknzr * a_this,
cur_char_val = 10 + (cur_char - 'A');
}
- unicode = unicode * 10 + cur_char_val;
+ unicode = unicode * 16 + cur_char_val;
PEEK_NEXT_CHAR (a_this, &cur_char);
}
- if (occur == 5) {
- /*
- *the unicode escape is 6 digit length
- */
-
- /*
- *parse one space that may
- *appear just after the unicode
- *escape.
- */
- cr_tknzr_parse_w (a_this, &tmp_char_ptr1,
- &tmp_char_ptr2, NULL);
- status = CR_OK;
- } else {
- /*
- *The unicode escape is less than
- *6 digit length. The character
- *that comes right after the escape
- *must be a white space.
- */
- status = cr_tknzr_parse_w (a_this, &tmp_char_ptr1,
- &tmp_char_ptr2, NULL);
- }
-
- if (status == CR_OK) {
- *a_unicode = unicode;
- return CR_OK;
- }
+ /* Eat a whitespace if possible. */
+ cr_tknzr_parse_w (a_this, &tmp_char_ptr1,
+ &tmp_char_ptr2, NULL);
+ *a_unicode = unicode;
+ return CR_OK;
error:
/*
status = cr_tknzr_parse_num (a_this, &num);
ENSURE_PARSING_COND ((status == CR_OK) && (num != NULL));
+ if (num->val > G_MAXLONG) {
+ status = CR_PARSING_ERROR;
+ goto error;
+ }
+
red = num->val;
cr_num_destroy (num);
num = NULL;
status = cr_tknzr_parse_num (a_this, &num);
ENSURE_PARSING_COND ((status == CR_OK) && (num != NULL));
+ if (num->val > G_MAXLONG) {
+ status = CR_PARSING_ERROR;
+ goto error;
+ }
+
PEEK_BYTE (a_this, 1, &next_bytes[0]);
if (next_bytes[0] == '%') {
SKIP_CHARS (a_this, 1);
*@param a_num out parameter. The parsed number.
*@return CR_OK upon successfull completion,
*an error code otherwise.
+ *
+ *The CSS specification says that numbers may be
+ *preceeded by '+' or '-' to indicate the sign.
+ *Technically, the "num" construction as defined
+ *by the tokenizer doesn't allow this, but we parse
+ *it here for simplicity.
*/
static enum CRStatus
cr_tknzr_parse_num (CRTknzr * a_this,
{
enum CRStatus status = CR_PARSING_ERROR;
enum CRNumType val_type = NUM_GENERIC;
- gboolean parsing_dec = FALSE,
- parsed = FALSE;
+ gboolean parsing_dec, /* true iff seen decimal point. */
+ parsed; /* true iff the substring seen so far is a valid CSS
+ number, i.e. `[0-9]+|[0-9]*\.[0-9]+'. */
guint32 cur_char = 0,
- int_part = 0,
- dec_part = 0,
- next_char = 0,
- decimal_places = 0;
+ next_char = 0;
+ gdouble numerator, denominator = 1;
CRInputPos init_pos;
CRParsingLocation location = {0} ;
+ int sign = 1;
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& PRIVATE (a_this)->input,
CR_BAD_PARAM_ERROR);
RECORD_INITIAL_POS (a_this, &init_pos);
- READ_NEXT_CHAR (a_this, &cur_char);
- if (IS_NUM (cur_char) == TRUE) {
- int_part = int_part * 10 + (cur_char - '0');
+ READ_NEXT_CHAR (a_this, &cur_char);
+
+ if (cur_char == '+' || cur_char == '-') {
+ if (cur_char == '-') {
+ sign = -1;
+ }
+ READ_NEXT_CHAR (a_this, &cur_char);
+ }
+ if (IS_NUM (cur_char)) {
+ numerator = (cur_char - '0');
+ parsing_dec = FALSE;
parsed = TRUE;
} else if (cur_char == '.') {
+ numerator = 0;
parsing_dec = TRUE;
+ parsed = FALSE;
} else {
status = CR_PARSING_ERROR;
goto error;
break;
}
if (next_char == '.') {
- if (parsing_dec == TRUE) {
+ if (parsing_dec) {
status = CR_PARSING_ERROR;
goto error;
}
READ_NEXT_CHAR (a_this, &cur_char);
parsing_dec = TRUE;
- parsed = TRUE;
- } else if (IS_NUM (next_char) == TRUE) {
+ parsed = FALSE; /* In CSS, there must be at least
+ one digit after `.'. */
+ } else if (IS_NUM (next_char)) {
READ_NEXT_CHAR (a_this, &cur_char);
parsed = TRUE;
- if (parsing_dec == FALSE) {
- int_part = int_part * 10 + (cur_char - '0');
- } else {
- decimal_places++;
- dec_part = dec_part * 10 + (cur_char - '0');
+ numerator = numerator * 10 + (cur_char - '0');
+ if (parsing_dec) {
+ denominator *= 10;
}
} else {
break;
}
}
- if (parsed == FALSE) {
+ if (!parsed) {
status = CR_PARSING_ERROR;
}
*Now, set the output param values.
*/
if (status == CR_OK) {
- gdouble val = 0.0;
-
- val = int_part;
- val += cr_utils_n_to_0_dot_n (dec_part, decimal_places);
+ gdouble val = (numerator / denominator) * sign;
if (*a_num == NULL) {
*a_num = cr_num_new_with_val (val, val_type);
CRTknzr *result = NULL;
CRInput *input = NULL;
- input = cr_input_new_from_uri (a_file_uri, a_enc);
+ input = cr_input_new_from_uri ((const gchar *) a_file_uri, a_enc);
g_return_val_if_fail (input != NULL, NULL);
result = cr_tknzr_new (input);
enum CRStatus
cr_tknzr_consume_chars (CRTknzr * a_this, guint32 a_char, glong * a_nb_char)
{
+ gulong consumed = *(gulong *) a_nb_char;
+ enum CRStatus status;
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& PRIVATE (a_this)->input, CR_BAD_PARAM_ERROR);
PRIVATE (a_this)->token_cache = NULL;
}
- return cr_input_consume_chars (PRIVATE (a_this)->input,
- a_char, a_nb_char);
+ status = cr_input_consume_chars (PRIVATE (a_this)->input,
+ a_char, &consumed);
+ *a_nb_char = (glong) consumed;
+ return status;
}
enum CRStatus
if (BYTE (input, 2, NULL) == 'r'
&& BYTE (input, 3, NULL) == 'l'
&& BYTE (input, 4, NULL) == '(') {
- CRString *str = NULL;
+ CRString *str2 = NULL;
- status = cr_tknzr_parse_uri (a_this, &str);
+ status = cr_tknzr_parse_uri (a_this, &str2);
if (status == CR_OK) {
- status = cr_token_set_uri (token, str);
+ status = cr_token_set_uri (token, str2);
CHECK_PARSING_STATUS (status, TRUE);
- if (str) {
+ if (str2) {
cr_parsing_location_copy (&token->location,
- &str->location) ;
+ &str2->location) ;
}
goto done;
}
- } else {
- status = cr_tknzr_parse_ident (a_this, &str);
- if (status == CR_OK && str) {
- status = cr_token_set_ident (token, str);
- CHECK_PARSING_STATUS (status, TRUE);
- if (str) {
- cr_parsing_location_copy (&token->location,
- &str->location) ;
- }
- goto done;
- }
- }
+ }
+ goto fallback;
break;
case 'r':
goto done;
}
- } else {
- status = cr_tknzr_parse_ident (a_this, &str);
- if (status == CR_OK) {
- status = cr_token_set_ident (token, str);
- CHECK_PARSING_STATUS (status, TRUE);
- if (str) {
- cr_parsing_location_copy (&token->location,
- &str->location) ;
- }
- str = NULL;
- goto done;
- }
}
+ goto fallback;
break;
case '<':
- if (BYTE (input, 2, NULL) == '-'
- && BYTE (input, 3, NULL) == '-') {
+ if (BYTE (input, 2, NULL) == '!'
+ && BYTE (input, 3, NULL) == '-'
+ && BYTE (input, 4, NULL) == '-') {
SKIP_CHARS (a_this, 1);
cr_tknzr_get_parsing_location (a_this,
&location) ;
- SKIP_CHARS (a_this, 2);
+ SKIP_CHARS (a_this, 3);
status = cr_token_set_cdo (token);
CHECK_PARSING_STATUS (status, TRUE);
cr_parsing_location_copy (&token->location,
&str->location) ;
}
goto done;
+ } else {
+ goto parse_number;
}
}
break;
case '8':
case '9':
case '.':
+ case '+':
+ /* '-' case is handled separately above for --> comments */
+ parse_number:
{
CRNum *num = NULL;
next_bytes[0] = BYTE (input, 1, NULL);
next_bytes[1] = BYTE (input, 2, NULL);
next_bytes[2] = BYTE (input, 3, NULL);
- next_bytes[3] = BYTE (input, 3, NULL);
+ next_bytes[3] = BYTE (input, 4, NULL);
if (next_bytes[0] == 'e'
&& next_bytes[1] == 'm') {
break;
default:
+ fallback:
/*process the fallback cases here */
if (next_char == '\\'
switch (a_this->type) {
case S_TK:
case CDO_TK:
+ case CDC_TK:
case INCLUDES_TK:
case DASHMATCH_TK:
case PAGE_SYM_TK:
gulong a_in_len,
guint32 * a_out, gulong * a_consumed)
{
- gulong in_len = 0,
- in_index = 0,
- nb_bytes_2_decode = 0;
+ gulong in_index = 0,
+ nb_bytes_2_decode = 0;
enum CRStatus status = CR_OK;
/*
goto end;
}
- in_len = a_in_len;
-
if (*a_in <= 0x7F) {
/*
*7 bits long char
if (*a_in_len == 0) {
*a_out_len = 0 ;
- return CR_OK ;
+ return status;
}
g_return_val_if_fail (a_out, CR_BAD_PARAM_ERROR) ;
- if (*a_in_len < 1) {
- status = CR_OK;
- goto end;
- }
-
in_len = *a_in_len;
out_len = *a_out_len;
}
} /*end for */
- end:
*a_in_len = in_index;
*a_out_len = out_index;
- return CR_OK;
+ return status;
}
/**
gulong * a_in_len,
guchar ** a_out, gulong * a_out_len)
{
- gulong in_len = 0,
- out_len = 0;
+ gulong out_len = 0;
enum CRStatus status = CR_OK;
g_return_val_if_fail (a_in && a_in_len && a_out
g_return_val_if_fail (status == CR_OK, status);
- in_len = *a_in_len;
-
*a_out = g_malloc0 (out_len);
status = cr_utils_ucs1_to_utf8 (a_in, a_in_len, *a_out, &out_len);
&& a_out && a_out_len, CR_BAD_PARAM_ERROR);
if (*a_in_len < 1) {
- status = CR_OK;
goto end;
}
*(if any) to get the current character.
*/
if (in_index + nb_bytes_2_decode - 1 >= in_len) {
- status = CR_OK;
goto end;
}
*a_out_len = out_index;
*a_in_len = in_index;
- return CR_OK;
+ return status;
}
/**
}
}
-gdouble
-cr_utils_n_to_0_dot_n (glong a_n, glong decimal_places)
-{
- gdouble result = a_n;
-
- while (decimal_places > 0) {
- result = result / 10;
- decimal_places--;
- }
-
- return result;
-}
-
/**
*Duplicates a list of GString instances.
*@return the duplicated list of GString instances or NULL if
*@param a_list_of_strings the list of strings to be duplicated.
*/
GList *
-cr_utils_dup_glist_of_string (GList * a_list_of_strings)
+cr_utils_dup_glist_of_string (GList const * a_list_of_strings)
{
- GList *cur = NULL,
- *result = NULL;
+ GList const *cur = NULL;
+ GList *result = NULL;
g_return_val_if_fail (a_list_of_strings, NULL);
*happened.
*/
GList *
-cr_utils_dup_glist_of_cr_string (GList * a_list_of_strings)
+cr_utils_dup_glist_of_cr_string (GList const * a_list_of_strings)
{
- GList *cur = NULL, *result = NULL;
+ GList const *cur = NULL;
+ GList *result = NULL;
g_return_val_if_fail (a_list_of_strings, NULL);
for (cur = a_list_of_strings; cur; cur = cur->next) {
CRString *str = NULL;
- str = cr_string_dup ((CRString *) cur->data) ;
+ str = cr_string_dup ((CRString const *) cur->data) ;
if (str)
result = g_list_append (result, str);
}
cr_utils_dump_n_chars2 (guchar a_char,
GString *a_string,
glong a_nb) ;
-gdouble
-cr_utils_n_to_0_dot_n (glong a_n, glong decimal_places) ;
-
GList *
-cr_utils_dup_glist_of_string (GList *a_list) ;
+cr_utils_dup_glist_of_string (GList const *a_list) ;
GList *
-cr_utils_dup_glist_of_cr_string (GList * a_list_of_strings) ;
+cr_utils_dup_glist_of_cr_string (GList const * a_list_of_strings) ;
G_END_DECLS
#ifndef LIBCROCO_VERSION_NUMBER
-#define LIBCROCO_VERSION_NUMBER 601
+#define LIBCROCO_VERSION_NUMBER 612
#endif
#ifndef LIBCROCO_VERSION
-#define LIBCROCO_VERSION "0.6.1"
+#define LIBCROCO_VERSION "0.6.12"
#endif
#ifndef G_DISABLE_CHECKS
#endif
#endif
-#if 1
-#define CROCO_HAVE_LIBXML2 1
+#ifndef CROCO_HAVE_LIBXML2
+#define CROCO_HAVE_LIBXML2 (1)
#endif
-
-# libglib.m4 serial 4
+# libglib.m4 serial 5
dnl Copyright (C) 2006-2007, 2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
LIBGLIB_H="$LIBGLIB_H glibconfig.h"
LIBGLIB_H="$LIBGLIB_H glib/ghash.h"
LIBGLIB_H="$LIBGLIB_H glib/glist.h"
+ LIBGLIB_H="$LIBGLIB_H glib/gmacros.h"
LIBGLIB_H="$LIBGLIB_H glib/gprimes.h"
+ LIBGLIB_H="$LIBGLIB_H glib/gprintfint.h"
LIBGLIB_H="$LIBGLIB_H glib/gstrfuncs.h"
LIBGLIB_H="$LIBGLIB_H glib/gstring.h"
LIBGLIB_H="$LIBGLIB_H glib/gtypes.h"
Description:
-Substitute for libcroco version 0.6.1.
+Substitute for libcroco version 0.6.13.
Files:
lib/libcroco/cr-additional-sel.c
lib/glib/ghash.in.h
lib/glib/glist.c
lib/glib/glist.in.h
+lib/glib/gmacros.in.h
lib/glib/gmessages.c
lib/glib/gprimes.c
lib/glib/gprimes.in.h
+lib/glib/gprintfint.in.h
lib/glib/gstrfuncs.c
lib/glib/gstrfuncs.in.h
lib/glib/gstring.c
m4/libglib.m4
Depends-on:
+snprintf-posix
strerror
vasprintf
xalloc
} > $@-t
mv -f $@-t $@
+glib/gmacros.h: glib/gmacros.in.h
+ test -d glib || $(MKDIR_P) glib
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ cat $(srcdir)/glib/gmacros.in.h; \
+ } > $@-t
+ mv -f $@-t $@
+
glib/gprimes.h: glib/gprimes.in.h
test -d glib || $(MKDIR_P) glib
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
} > $@-t
mv -f $@-t $@
+glib/gprintfint.h: glib/gprintfint.in.h
+ test -d glib || $(MKDIR_P) glib
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ cat $(srcdir)/glib/gprintfint.in.h; \
+ } > $@-t
+ mv -f $@-t $@
+
glib/gstrfuncs.h: glib/gstrfuncs.in.h
test -d glib || $(MKDIR_P) glib
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
glibconfig.h \
glib/ghash.h \
glib/glist.h \
+ glib/gmacros.h \
glib/gprimes.h \
+ glib/gprintfint.h \
glib/gstrfuncs.h \
glib/gstring.h \
glib/gtypes.h