WIP - add extractor, generate snippet_data

This commit is contained in:
Stefan Fejes
2019-08-20 15:52:05 +02:00
parent 88084d3d30
commit cc8f1d8a7a
37396 changed files with 4588842 additions and 133 deletions

View File

@ -0,0 +1,98 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli
* See the COPYRIGHTS file for copyright information.
*/
#ifndef __CR_ADD_SEL_H__
#define __CR_ADD_SEL_H__
#include <stdio.h>
#include <glib.h>
#include "cr-utils.h"
#include "cr-attr-sel.h"
#include "cr-pseudo.h"
#include "cr-additional-sel.h"
G_BEGIN_DECLS
enum AddSelectorType
{
NO_ADD_SELECTOR = 0 ,
CLASS_ADD_SELECTOR = 1 ,
PSEUDO_CLASS_ADD_SELECTOR = 1 << 1,
ID_ADD_SELECTOR = 1 << 3,
ATTRIBUTE_ADD_SELECTOR = 1 << 4
} ;
union CRAdditionalSelectorContent
{
CRString *class_name ;
CRString *id_name ;
CRPseudo *pseudo ;
CRAttrSel *attr_sel ;
} ;
typedef struct _CRAdditionalSel CRAdditionalSel ;
struct _CRAdditionalSel
{
enum AddSelectorType type ;
union CRAdditionalSelectorContent content ;
CRAdditionalSel * next ;
CRAdditionalSel * prev ;
CRParsingLocation location ;
} ;
CRAdditionalSel * cr_additional_sel_new (void) ;
CRAdditionalSel * cr_additional_sel_new_with_type (enum AddSelectorType a_sel_type) ;
CRAdditionalSel * cr_additional_sel_append (CRAdditionalSel *a_this,
CRAdditionalSel *a_sel) ;
void cr_additional_sel_set_class_name (CRAdditionalSel *a_this,
CRString *a_class_name) ;
void cr_additional_sel_set_id_name (CRAdditionalSel *a_this,
CRString *a_id) ;
void cr_additional_sel_set_pseudo (CRAdditionalSel *a_this,
CRPseudo *a_pseudo) ;
void cr_additional_sel_set_attr_sel (CRAdditionalSel *a_this,
CRAttrSel *a_sel) ;
CRAdditionalSel * cr_additional_sel_prepend (CRAdditionalSel *a_this,
CRAdditionalSel *a_sel) ;
guchar * cr_additional_sel_to_string (CRAdditionalSel const *a_this) ;
guchar * cr_additional_sel_one_to_string (CRAdditionalSel const *a_this) ;
void cr_additional_sel_dump (CRAdditionalSel const *a_this, FILE *a_fp) ;
void cr_additional_sel_destroy (CRAdditionalSel *a_this) ;
G_END_DECLS
#endif /*__CR_ADD_SEL_H*/

View File

@ -0,0 +1,74 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli
* See COPYRIGHTS file for copyright information.
*/
#ifndef __CR_ATTR_SEL_H__
#define __CR_ATTR_SEL_H__
#include <stdio.h>
#include <glib.h>
#include "cr-utils.h"
#include "cr-parsing-location.h"
#include "cr-string.h"
G_BEGIN_DECLS
struct _CRAttrSel ;
typedef struct _CRAttrSel CRAttrSel ;
enum AttrMatchWay
{
NO_MATCH = 0,
SET,
EQUALS,
INCLUDES,
DASHMATCH
} ;
struct _CRAttrSel
{
CRString *name ;
CRString *value ;
enum AttrMatchWay match_way ;
CRAttrSel *next ;
CRAttrSel *prev ;
CRParsingLocation location ;
} ;
CRAttrSel * cr_attr_sel_new (void) ;
enum CRStatus cr_attr_sel_append_attr_sel (CRAttrSel * a_this,
CRAttrSel *a_attr_sel) ;
enum CRStatus cr_attr_sel_prepend_attr_sel (CRAttrSel *a_this,
CRAttrSel *a_attr_sel) ;
guchar * cr_attr_sel_to_string (CRAttrSel const *a_this) ;
void cr_attr_sel_dump (CRAttrSel const *a_this, FILE *a_fp) ;
void cr_attr_sel_destroy (CRAttrSel *a_this) ;
G_END_DECLS
#endif /*__CR_ATTR_SEL_H__*/

View File

@ -0,0 +1,74 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the
* GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the
* GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
*/
/*
*$Id$
*/
#ifndef __CR_CASCADE_H__
#define __CR_CASCADE_H__
#include "cr-stylesheet.h"
/**
*@file
*the declaration of the #CRCascade class.
*/
G_BEGIN_DECLS
typedef struct _CRCascadePriv CRCascadePriv ;
/**
*An abstraction of the "Cascade" defined
*in the css2 spec, chapter 6.4.
*/
typedef struct _CRCascade CRCascade ;
struct _CRCascade
{
CRCascadePriv *priv ;
};
CRCascade * cr_cascade_new (CRStyleSheet *a_author_sheet,
CRStyleSheet *a_user_sheet,
CRStyleSheet *a_ua_sheet) ;
CRStyleSheet * cr_cascade_get_sheet (CRCascade *a_this,
enum CRStyleOrigin a_origin) ;
enum CRStatus cr_cascade_set_sheet (CRCascade *a_this,
CRStyleSheet *a_sheet,
enum CRStyleOrigin a_origin) ;
void cr_cascade_ref (CRCascade *a_this) ;
void cr_cascade_unref (CRCascade *a_this) ;
void cr_cascade_destroy (CRCascade *a_this) ;
G_END_DECLS
#endif /*__CR_CASCADE_H__*/

View File

@ -0,0 +1,136 @@
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* See the COPYRIGHTS file for copyright information.
*/
#ifndef __CR_DECLARATION_H__
#define __CR_DECLARATION_H__
#include <stdio.h>
#include "cr-utils.h"
#include "cr-term.h"
#include "cr-parsing-location.h"
G_BEGIN_DECLS
/**
*@file
*The declaration of the #CRDeclaration class.
*/
/*forward declaration of what is defined in cr-statement.h*/
typedef struct _CRStatement CRStatement ;
/**
*The abstraction of a css declaration defined by the
*css2 spec in chapter 4.
*It is actually a chained list of property/value pairs.
*/
typedef struct _CRDeclaration CRDeclaration ;
struct _CRDeclaration
{
/**The property.*/
CRString *property ;
/**The value of the property.*/
CRTerm *value ;
/*the ruleset that contains this declaration*/
CRStatement *parent_statement ;
/*the next declaration*/
CRDeclaration *next ;
/*the previous one declaration*/
CRDeclaration *prev ;
/*does the declaration have the important keyword ?*/
gboolean important ;
glong ref_count ;
CRParsingLocation location ;
/*reserved for future usage*/
gpointer rfu0 ;
gpointer rfu1 ;
gpointer rfu2 ;
gpointer rfu3 ;
} ;
CRDeclaration * cr_declaration_new (CRStatement *a_statement,
CRString *a_property,
CRTerm *a_value) ;
CRDeclaration * cr_declaration_parse_from_buf (CRStatement *a_statement,
const guchar *a_str,
enum CREncoding a_enc) ;
CRDeclaration * cr_declaration_parse_list_from_buf (const guchar *a_str,
enum CREncoding a_enc) ;
CRDeclaration * cr_declaration_append (CRDeclaration *a_this,
CRDeclaration *a_new) ;
CRDeclaration * cr_declaration_append2 (CRDeclaration *a_this,
CRString *a_prop,
CRTerm *a_value) ;
CRDeclaration * cr_declaration_prepend (CRDeclaration *a_this,
CRDeclaration *a_new) ;
CRDeclaration * cr_declaration_unlink (CRDeclaration * a_decl) ;
void
cr_declaration_dump (CRDeclaration const *a_this,
FILE *a_fp, glong a_indent,
gboolean a_one_per_line) ;
void cr_declaration_dump_one (CRDeclaration const *a_this,
FILE *a_fp, glong a_indent) ;
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 const *a_this,
gulong a_indent) ;
guchar * cr_declaration_list_to_string (CRDeclaration const *a_this,
gulong a_indent) ;
guchar * cr_declaration_list_to_string2 (CRDeclaration const *a_this,
gulong a_indent,
gboolean a_one_decl_per_line) ;
void cr_declaration_ref (CRDeclaration *a_this) ;
gboolean cr_declaration_unref (CRDeclaration *a_this) ;
void cr_declaration_destroy (CRDeclaration *a_this) ;
G_END_DECLS
#endif /*__CR_DECLARATION_H__*/

View File

@ -0,0 +1,298 @@
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* See the COPYRIGHTS file for copyright information.
*/
#ifndef __CR_DOC_HANDLER_H__
#define __CR_DOC_HANDLER_H__
/**
*@file
*The declaration of the #CRDocumentHandler class.
*This class is actually the parsing events handler.
*/
#include <glib.h>
#include "cr-utils.h"
#include "cr-input.h"
#include "cr-stylesheet.h"
G_BEGIN_DECLS
typedef struct _CRDocHandler CRDocHandler ;
struct _CRDocHandlerPriv ;
typedef struct _CRDocHandlerPriv CRDocHandlerPriv ;
/**
*The SAC document handler.
*An instance of this class is to
*be passed to a parser. Then, during the parsing
*the parser calls the convenient function pointer
*whenever a particular event (a css construction) occurs.
*/
struct _CRDocHandler
{
CRDocHandlerPriv *priv ;
/**
*This pointer is to be used by the application for
*it custom needs. It is there to extend the doc handler.
*/
gpointer app_data ;
/**
*Is called at the beginning of the parsing of the document.
*@param a_this a pointer to the current instance of
*#CRDocHandler.
*/
void (*start_document) (CRDocHandler *a_this) ;
/**
*Is called to notify the end of the parsing of the document.
*@param a_this a pointer to the current instance of
*#CRDocHandler.
*/
void (*end_document) (CRDocHandler *a_this) ;
/**
*Is called to notify an at charset rule.
*@param a_this the document handler.
*@param a_charset the declared charset.
*/
void (*charset) (CRDocHandler *a_this,
CRString *a_charset,
CRParsingLocation *a_charset_sym_location) ;
/**
*Is called to notify an import statement in
*the stylesheet.
*@param a_this the current instance of #CRDocHandler.
*@param a_media_list a doubly linked list of GString objects.
*Each GString object contains a string which is the
*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'
*keyword.
*of the imported style sheet.
*/
void (*import_style) (CRDocHandler *a_this,
GList *a_media_list,
CRString *a_uri,
CRString *a_uri_default_ns,
CRParsingLocation *a_location) ;
void (*import_style_result) (CRDocHandler *a_this,
GList *a_media_list,
CRString *a_uri,
CRString *a_uri_default_ns,
CRStyleSheet *a_sheet) ;
/**
*Is called to notify a namespace declaration.
*Not used yet.
*@param a_this the current instance of #CRDocHandler.
*@param a_prefix the prefix of the namespace.
*@param a_uri the uri of the namespace.
*@param a_location the location of the "@namespace" keyword.
*/
void (*namespace_declaration) (CRDocHandler *a_this,
CRString *a_prefix,
CRString *a_uri,
CRParsingLocation *a_location) ;
/**
*Is called to notify a comment.
*@param a_this a pointer to the current instance
*of #CRDocHandler.
*@param a_comment the comment.
*/
void (*comment) (CRDocHandler *a_this,
CRString *a_comment) ;
/**
*Is called to notify the beginning of a rule
*statement.
*@param a_this the current instance of #CRDocHandler.
*@param a_selector_list the list of selectors that precedes
*the rule declarations.
*/
void (*start_selector) (CRDocHandler * a_this,
CRSelector *a_selector_list) ;
/**
*Is called to notify the end of a rule statement.
*@param a_this the current instance of #CRDocHandler.
*@param a_selector_list the list of selectors that precedes
*the rule declarations. This pointer is the same as
*the one passed to start_selector() ;
*/
void (*end_selector) (CRDocHandler *a_this,
CRSelector *a_selector_list) ;
/**
*Is called to notify a declaration.
*@param a_this a pointer to the current instance
*of #CRDocHandler.
*@param a_name the name of the parsed property.
*@param a_expression a css expression that represents
*the value of the property. A css expression is
*actually a linked list of 'terms'. Each term can
*be linked to other using operators.
*
*/
void (*property) (CRDocHandler *a_this,
CRString *a_name,
CRTerm *a_expression,
gboolean a_is_important) ;
/**
*Is called to notify the start of a font face statement.
*The parser invokes this method at the beginning of every
*font face statement in the style sheet. There will
*be a corresponding end_font_face () event for every
*start_font_face () event.
*
*@param a_this a pointer to the current instance of
*#CRDocHandler.
*@param a_location the parsing location of the "\@font-face"
*keyword.
*/
void (*start_font_face) (CRDocHandler *a_this,
CRParsingLocation *a_location) ;
/**
*Is called to notify the end of a font face statement.
*@param a_this a pointer to the current instance of
*#CRDocHandler.
*/
void (*end_font_face) (CRDocHandler *a_this) ;
/**
*Is called to notify the beginning of a media statement.
*The parser will invoke this method at the beginning of
*every media statement in the style sheet. There will be
*a corresponding end_media() event for every start_media()
*event.
*@param a_this a pointer to the current instance of
*#CRDocHandler.
*@param a_media_list a double linked list of
#CRString * objects.
*Each CRString objects is actually a destination media for
*the style information.
*/
void (*start_media) (CRDocHandler *a_this,
GList *a_media_list,
CRParsingLocation *a_location) ;
/**
*Is called to notify the end of a media statement.
*@param a_this a pointer to the current instance
*of #CRDocHandler.
*@param a_media_list a double linked list of GString * objects.
*Each GString objects is actually a destination media for
*the style information.
*/
void (*end_media) (CRDocHandler *a_this,
GList *a_media_list) ;
/**
*Is called to notify the beginning of a page statement.
*The parser invokes this function at the beginning of
*every page statement in the style sheet. There will be
*a corresponding end_page() event for every single
*start_page() event.
*@param a_this a pointer to the current instance of
*#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.
*/
void (*start_page) (CRDocHandler *a_this,
CRString *a_name,
CRString *a_pseudo_page,
CRParsingLocation *a_location) ;
/**
*Is called to notify the end of a page statement.
*@param a_this a pointer to the current instance of
*#CRDocHandler.
*@param a_name the name of the 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,
CRString *pseudo_page) ;
/**
*Is Called to notify an unknown at-rule not supported
*by this parser.
*/
void (*ignorable_at_rule) (CRDocHandler *a_this,
CRString *a_name) ;
/**
*Is called to notify a parsing error. After this error
*the application must ignore the rule being parsed, if
*any. After completion of this callback,
*the parser will then try to resume the parsing,
*ignoring the current error.
*/
void (*error) (CRDocHandler *a_this) ;
/**
*Is called to notify an unrecoverable parsing error.
*This is the place to put emergency routines that free allocated
*resources.
*/
void (*unrecoverable_error) (CRDocHandler *a_this) ;
gboolean resolve_import ;
gulong ref_count ;
} ;
CRDocHandler * cr_doc_handler_new (void) ;
enum CRStatus cr_doc_handler_set_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 const *a_this, gpointer * a_ctxt) ;
enum CRStatus cr_doc_handler_set_default_sac_handler (CRDocHandler *a_this) ;
void cr_doc_handler_associate_a_parser (CRDocHandler *a_this,
gpointer a_parser) ;
void cr_doc_handler_ref (CRDocHandler *a_this) ;
gboolean cr_doc_handler_unref (CRDocHandler *a_this) ;
void cr_doc_handler_destroy (CRDocHandler *a_this) ;
G_END_DECLS
#endif /*__CR_DOC_HANDLER_H__*/

View File

@ -0,0 +1,94 @@
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
*
* Copyright (C) 2002-2003 Dodji Seketeli <dodji@seketeli.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
/*
*$Id$
*/
/**
*@file:
*The declaration of the #CREncHandler class.
*
*/
#ifndef __CR_ENC_HANDLER_H__
#define __CR_ENC_HANDLER_H__
#include "cr-utils.h"
G_BEGIN_DECLS
typedef struct _CREncHandler CREncHandler ;
typedef enum CRStatus (*CREncInputFunc) (const guchar * a_in,
gulong *a_in_len,
guchar *a_out,
gulong *a_out_len) ;
typedef enum CRStatus (*CREncOutputFunc) (const guchar * a_in,
gulong *a_in_len,
guchar *a_out,
gulong *a_out_len) ;
typedef enum CRStatus (*CREncInputStrLenAsUtf8Func)
(const guchar *a_in_start,
const guchar *a_in_end,
gulong *a_in_size);
typedef enum CRStatus (*CREncUtf8StrLenAsOutputFunc)
(const guchar *a_in_start,
const guchar *a_in_end,
gulong *a_in_size) ;
/**
*This class is responsible of the
*the encoding conversions stuffs in
*libcroco.
*/
struct _CREncHandler
{
enum CREncoding encoding ;
CREncInputFunc decode_input ;
CREncInputFunc encode_output ;
CREncInputStrLenAsUtf8Func enc_str_len_as_utf8 ;
CREncUtf8StrLenAsOutputFunc utf8_str_len_as_enc ;
} ;
CREncHandler *
cr_enc_handler_get_instance (enum CREncoding a_enc) ;
enum CRStatus
cr_enc_handler_resolve_enc_alias (const guchar *a_alias_name,
enum CREncoding *a_enc) ;
enum CRStatus
cr_enc_handler_convert_input (CREncHandler *a_this,
const guchar *a_in,
gulong *a_in_len,
guchar **a_out,
gulong *a_out_len) ;
G_END_DECLS
#endif /*__CR_ENC_HANDLER_H__*/

315
node_modules/sharp/vendor/include/libcroco/cr-fonts.h generated vendored Normal file
View File

@ -0,0 +1,315 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of
* the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the
* GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli
* See COPYRIGHTS file for copyright information.
*/
#ifndef __CR_FONTS_H__
#define __CR_FONTS_H__
#include "cr-utils.h"
#include "cr-num.h"
/**
*@file
*Various type declarations about font selection related
*properties.
*/
G_BEGIN_DECLS
enum CRFontFamilyType
{
FONT_FAMILY_SANS_SERIF,
FONT_FAMILY_SERIF,
FONT_FAMILY_CURSIVE,
FONT_FAMILY_FANTASY,
FONT_FAMILY_MONOSPACE,
FONT_FAMILY_NON_GENERIC,
FONT_FAMILY_INHERIT,
/**/
NB_FONT_FAMILIE_TYPES
} ;
typedef struct _CRFontFamily CRFontFamily ;
struct _CRFontFamily
{
enum CRFontFamilyType type ;
/*
*The name of the font family, in case
*it is non generic.
*Is set only if the type is FONT_FAMILY_NON_GENERIC.
*/
guchar *name ;
CRFontFamily *next ;
CRFontFamily *prev ;
} ;
/**
*The different types
*of absolute font size.
*This is used by the 'font-size'
*property defined in css2 spec
*in chapter 15.2.4 .
*These values a indexes of
*table of size so please, do not
*change their definition order unless
*you know what you are doing.
*/
enum CRPredefinedAbsoluteFontSize
{
FONT_SIZE_XX_SMALL=0,
FONT_SIZE_X_SMALL,
FONT_SIZE_SMALL,
FONT_SIZE_MEDIUM,
FONT_SIZE_LARGE,
FONT_SIZE_X_LARGE,
FONT_SIZE_XX_LARGE,
FONT_SIZE_INHERIT,
NB_PREDEFINED_ABSOLUTE_FONT_SIZES
} ;
/**
*The different types
*of relative font size.
*This is used by the 'font-size'
*property defined in css2 spec
*in chapter 15.2.4 .
*These values a indexes of
*table of size so please, do not
*change their definition order unless
*you know what you are doing.
*/
enum CRRelativeFontSize
{
FONT_SIZE_LARGER,
FONT_SIZE_SMALLER,
NB_RELATIVE_FONT_SIZE
} ;
/**
*The type of font-size property.
*Used to define the type of #CRFontSize .
*See css2 spec chapter 15.2.4 to understand.
*/
enum CRFontSizeType {
/**
*If the type of #CRFontSize is
*PREDEFINED_ABSOLUTE_FONT_SIZE,
*the CRFontSize::value.predefined_absolute
*field will be defined.
*/
PREDEFINED_ABSOLUTE_FONT_SIZE,
/**
*If the type of #CRFontSize is
*ABSOLUTE_FONT_SIZE,
*the CRFontSize::value.absolute
*field will be defined.
*/
ABSOLUTE_FONT_SIZE,
/**
*If the type of #CRFontSize is
*RELATIVE_FONT_SIZE,
*the CRFontSize::value.relative
*field will be defined.
*/
RELATIVE_FONT_SIZE,
/**
*If the type of #CRFontSize is
*INHERITED_FONT_SIZE,
*the None of the field of the CRFontSize::value enum
*will be defined.
*/
INHERITED_FONT_SIZE,
NB_FONT_SIZE_TYPE
} ;
typedef struct _CRFontSize CRFontSize ;
struct _CRFontSize {
enum CRFontSizeType type ;
union {
enum CRPredefinedAbsoluteFontSize predefined ;
enum CRRelativeFontSize relative ;
CRNum absolute ;
} value;
} ;
enum CRFontSizeAdjustType
{
FONT_SIZE_ADJUST_NONE = 0,
FONT_SIZE_ADJUST_NUMBER,
FONT_SIZE_ADJUST_INHERIT
} ;
typedef struct _CRFontSizeAdjust CRFontSizeAdjust ;
struct _CRFontSizeAdjust
{
enum CRFontSizeAdjustType type ;
CRNum *num ;
} ;
enum CRFontStyle
{
FONT_STYLE_NORMAL=0,
FONT_STYLE_ITALIC,
FONT_STYLE_OBLIQUE,
FONT_STYLE_INHERIT
} ;
enum CRFontVariant
{
FONT_VARIANT_NORMAL=0,
FONT_VARIANT_SMALL_CAPS,
FONT_VARIANT_INHERIT
} ;
enum CRFontWeight
{
FONT_WEIGHT_NORMAL = 1,
FONT_WEIGHT_BOLD = 1<<1,
FONT_WEIGHT_BOLDER = 1<<2,
FONT_WEIGHT_LIGHTER = 1<<3,
FONT_WEIGHT_100 = 1<<4,
FONT_WEIGHT_200 = 1<<5,
FONT_WEIGHT_300 = 1<<6,
FONT_WEIGHT_400 = 1<<7,
FONT_WEIGHT_500 = 1<<8,
FONT_WEIGHT_600 = 1<<9,
FONT_WEIGHT_700 = 1<<10,
FONT_WEIGHT_800 = 1<<11,
FONT_WEIGHT_900 = 1<<12,
FONT_WEIGHT_INHERIT = 1<<13,
NB_FONT_WEIGHTS
} ;
enum CRFontStretch
{
FONT_STRETCH_NORMAL=0,
FONT_STRETCH_WIDER,
FONT_STRETCH_NARROWER,
FONT_STRETCH_ULTRA_CONDENSED,
FONT_STRETCH_EXTRA_CONDENSED,
FONT_STRETCH_CONDENSED,
FONT_STRETCH_SEMI_CONDENSED,
FONT_STRETCH_SEMI_EXPANDED,
FONT_STRETCH_EXPANDED,
FONT_STRETCH_EXTRA_EXPANDED,
FONT_STRETCH_ULTRA_EXPANDED,
FONT_STRETCH_INHERIT
} ;
/**************************************
*'font-family' manipulation functions
***************************************/
CRFontFamily *
cr_font_family_new (enum CRFontFamilyType a_type, guchar *a_name) ;
CRFontFamily *
cr_font_family_append (CRFontFamily *a_this,
CRFontFamily *a_family_to_append) ;
guchar *
cr_font_family_to_string (CRFontFamily const *a_this,
gboolean a_walk_font_family_list) ;
CRFontFamily *
cr_font_family_prepend (CRFontFamily *a_this,
CRFontFamily *a_family_to_prepend);
enum CRStatus
cr_font_family_destroy (CRFontFamily *a_this) ;
enum CRStatus
cr_font_family_set_name (CRFontFamily *a_this, guchar *a_name) ;
/************************************
*'font-size' manipulation functions
***********************************/
CRFontSize * cr_font_size_new (void) ;
enum CRStatus cr_font_size_clear (CRFontSize *a_this) ;
enum CRStatus cr_font_size_copy (CRFontSize *a_dst,
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 CRRelativeFontSize a_relative) ;
enum CRStatus cr_font_size_set_absolute_font_size (CRFontSize *a_this,
enum CRNumType a_num_type,
gdouble a_value) ;
enum CRStatus cr_font_size_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 const *a_this) ;
void cr_font_size_destroy (CRFontSize *a_font_size) ;
/*******************************************************
*'font-size-adjust' manipulation function declarations
*******************************************************/
CRFontSizeAdjust * cr_font_size_adjust_new (void) ;
gchar * cr_font_size_adjust_to_string (CRFontSizeAdjust const *a_this) ;
void cr_font_size_adjust_destroy (CRFontSizeAdjust *a_this) ;
void
cr_font_size_get_smaller_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size,
enum CRPredefinedAbsoluteFontSize *a_smaller_size) ;
void
cr_font_size_get_larger_predefined_font_size (enum CRPredefinedAbsoluteFontSize a_font_size,
enum CRPredefinedAbsoluteFontSize *a_larger_size) ;
gboolean
cr_font_size_is_predefined_absolute_font_size (enum CRPredefinedAbsoluteFontSize a_font_size) ;
/***********************************
*various other font related functions
***********************************/
const gchar * cr_font_style_to_string (enum CRFontStyle a_code) ;
const gchar * cr_font_weight_to_string (enum CRFontWeight a_code) ;
enum CRFontWeight
cr_font_weight_get_bolder (enum CRFontWeight a_weight) ;
const gchar * cr_font_variant_to_string (enum CRFontVariant a_code) ;
const gchar * cr_font_stretch_to_string (enum CRFontStretch a_code) ;
G_END_DECLS
#endif

174
node_modules/sharp/vendor/include/libcroco/cr-input.h generated vendored Normal file
View File

@ -0,0 +1,174 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset:8 -*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli
* See the COPYRIGHTS file for copyrights information.
*/
#ifndef __CR_INPUT_SRC_H__
#define __CR_INPUT_SRC_H__
#include <glib.h>
#include "cr-utils.h"
#include "cr-parsing-location.h"
G_BEGIN_DECLS
/**
*@file
*The libcroco basic input stream class
*declaration file.
*/
typedef struct _CRInput CRInput ;
typedef struct _CRInputPriv CRInputPriv ;
/**
*The #CRInput class provides the abstraction of
*an utf8-encoded character stream.
*/
struct _CRInput
{
CRInputPriv *priv ;
} ;
typedef struct _CRInputPos CRInputPos ;
struct _CRInputPos
{
glong line ;
glong col ;
gboolean end_of_file ;
gboolean end_of_line ;
glong next_byte_index ;
} ;
CRInput *
cr_input_new_from_buf (guchar *a_buf, gulong a_len,
enum CREncoding a_enc, gboolean a_free_buf) ;
CRInput *
cr_input_new_from_uri (const gchar *a_file_uri,
enum CREncoding a_enc) ;
void
cr_input_destroy (CRInput *a_this) ;
void
cr_input_ref (CRInput *a_this) ;
gboolean
cr_input_unref (CRInput *a_this) ;
enum CRStatus
cr_input_read_byte (CRInput *a_this, guchar *a_byte) ;
enum CRStatus
cr_input_read_char (CRInput *a_this, guint32 *a_char) ;
enum CRStatus
cr_input_consume_chars (CRInput *a_this, guint32 a_char,
gulong *a_nb_char) ;
enum CRStatus
cr_input_consume_char (CRInput *a_this, guint32 a_char) ;
enum CRStatus
cr_input_consume_white_spaces (CRInput *a_this, gulong *a_nb_chars) ;
enum CRStatus
cr_input_peek_byte (CRInput const *a_this, enum CRSeekPos a_origin,
gulong a_offset, guchar *a_byte) ;
guchar
cr_input_peek_byte2 (CRInput const *a_this, gulong a_offset,
gboolean *a_eof) ;
enum CRStatus
cr_input_peek_char (CRInput const *a_this, guint32 *a_char) ;
guchar *
cr_input_get_byte_addr (CRInput *a_this,
gulong a_offset) ;
enum CRStatus
cr_input_get_cur_byte_addr (CRInput *a_this, guchar ** a_offset) ;
enum CRStatus
cr_input_seek_index (CRInput *a_this,
enum CRSeekPos a_origin, gint a_pos) ;
enum CRStatus
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 const *a_this, CRInputPos * a_pos) ;
enum CRStatus
cr_input_set_cur_pos (CRInput *a_this, CRInputPos const *a_pos) ;
enum CRStatus
cr_input_get_parsing_location (CRInput const *a_this,
CRParsingLocation *a_loc) ;
enum CRStatus
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 const *a_this, gboolean *a_eof) ;
enum CRStatus
cr_input_set_end_of_file (CRInput *a_this, gboolean a_eof) ;
enum CRStatus
cr_input_set_line_num (CRInput *a_this, glong a_line_num) ;
enum CRStatus
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 const *a_this, glong *a_col) ;
enum CRStatus
cr_input_increment_line_num (CRInput *a_this,
glong a_increment) ;
enum CRStatus
cr_input_increment_col_num (CRInput *a_this,
glong a_increment) ;
glong
cr_input_get_nb_bytes_left (CRInput const *a_this) ;
enum CRStatus
cr_input_end_of_input (CRInput const *a_this, gboolean *a_end_of_input) ;
G_END_DECLS
#endif /*__CR_INPUT_SRC_H__*/

127
node_modules/sharp/vendor/include/libcroco/cr-num.h generated vendored Normal file
View File

@ -0,0 +1,127 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli
* See COPYRIGHTS file for copyright information
*/
/**
*@file
*The declaration
*of the #CRNum class.
*/
#ifndef __CR_NUM_H__
#define __CR_NUM_H__
#include <glib.h>
#include "cr-utils.h"
#include "cr-parsing-location.h"
G_BEGIN_DECLS
/**
*@file
*The declaration of the #CRNum class.
*
*/
/**
*The different types
*of numbers.
*Please, do not modify
*the declaration order of the enum
*members, unless you know
*what you are doing.
*/
enum CRNumType
{
NUM_AUTO = 0,
NUM_GENERIC,
NUM_LENGTH_EM,
NUM_LENGTH_EX,
NUM_LENGTH_PX,
NUM_LENGTH_IN,
NUM_LENGTH_CM,
NUM_LENGTH_MM,
NUM_LENGTH_PT,
NUM_LENGTH_PC,
NUM_ANGLE_DEG,
NUM_ANGLE_RAD,
NUM_ANGLE_GRAD,
NUM_TIME_MS,
NUM_TIME_S,
NUM_FREQ_HZ,
NUM_FREQ_KHZ,
NUM_PERCENTAGE,
NUM_INHERIT,
NUM_UNKNOWN_TYPE,
NB_NUM_TYPE
} ;
/**
*An abstraction of a number (num)
*as defined in the css2 spec.
*/
typedef struct _CRNum CRNum ;
/**
*An abstraction of a number (num)
*as defined in the css2 spec.
*/
struct _CRNum
{
enum CRNumType type ;
gdouble val ;
CRParsingLocation location ;
} ;
CRNum *
cr_num_new (void) ;
CRNum *
cr_num_new_with_val (gdouble a_val,
enum CRNumType a_type) ;
CRNum *
cr_num_dup (CRNum const *a_this) ;
guchar *
cr_num_to_string (CRNum const *a_this) ;
enum CRStatus
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 const *a_this) ;
void
cr_num_destroy (CRNum *a_this) ;
G_END_DECLS
#endif /*__CR_NUM_H__*/

View File

@ -0,0 +1,98 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
/*
* This file is part of The Croco Library
*
* Copyright (C) 2002-2003 Dodji Seketeli <dodji@seketeli.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the
* GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
/*
*$Id$
*/
#ifndef __CR_OM_PARSER_H__
#define __CR_OM_PARSER_H__
#include "cr-parser.h"
#include "cr-cascade.h"
/**
*@file
*The definition of the CSS Object Model Parser.
*This parser uses (and sits) the SAC api of libcroco defined
*in cr-parser.h and cr-doc-handler.h
*/
G_BEGIN_DECLS
typedef struct _CROMParser CROMParser ;
typedef struct _CROMParserPriv CROMParserPriv ;
/**
*The Object model parser.
*Can parse a css file and build a css object model.
*This parser uses an instance of #CRParser and defines
*a set of SAC callbacks to build the Object Model.
*/
struct _CROMParser
{
CROMParserPriv *priv ;
} ;
CROMParser * cr_om_parser_new (CRInput *a_input) ;
enum CRStatus cr_om_parser_simply_parse_file (const guchar *a_file_path,
enum CREncoding a_enc,
CRStyleSheet **a_result) ;
enum CRStatus cr_om_parser_parse_file (CROMParser *a_this,
const guchar *a_file_uri,
enum CREncoding a_enc,
CRStyleSheet **a_result) ;
enum CRStatus cr_om_parser_simply_parse_buf (const guchar *a_buf,
gulong a_len,
enum CREncoding a_enc,
CRStyleSheet **a_result) ;
enum CRStatus cr_om_parser_parse_buf (CROMParser *a_this,
const guchar *a_buf,
gulong a_len,
enum CREncoding a_enc,
CRStyleSheet **a_result) ;
enum CRStatus cr_om_parser_parse_paths_to_cascade (CROMParser *a_this,
const guchar *a_author_path,
const guchar *a_user_path,
const guchar *a_ua_path,
enum CREncoding a_encoding,
CRCascade ** a_result) ;
enum CRStatus cr_om_parser_simply_parse_paths_to_cascade (const guchar *a_author_path,
const guchar *a_user_path,
const guchar *a_ua_path,
enum CREncoding a_encoding,
CRCascade ** a_result) ;
void cr_om_parser_destroy (CROMParser *a_this) ;
G_END_DECLS
#endif /*__CR_OM_PARSER_H__*/

128
node_modules/sharp/vendor/include/libcroco/cr-parser.h generated vendored Normal file
View File

@ -0,0 +1,128 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli
* See COPYRIGHTS file for copyrights information.
*/
#ifndef __CR_PARSER_H__
#define __CR_PARSER_H__
#include <glib.h>
#include "cr-input.h"
#include "cr-tknzr.h"
#include "cr-utils.h"
#include "cr-doc-handler.h"
G_BEGIN_DECLS
/**
*@file
*The declaration file
*of the #CRParser class.
*/
typedef struct _CRParser CRParser ;
typedef struct _CRParserPriv CRParserPriv ;
/**
*The implementation of
*the SAC parser.
*The Class is opaque
*and must be manipulated through
*the provided methods.
*/
struct _CRParser {
CRParserPriv *priv ;
} ;
CRParser * cr_parser_new (CRTknzr *a_tknzr) ;
CRParser * cr_parser_new_from_buf (guchar *a_buf, gulong a_len,
enum CREncoding a_enc,
gboolean a_free_buf) ;
CRParser * cr_parser_new_from_file (const guchar *a_file_uri,
enum CREncoding a_enc) ;
CRParser * cr_parser_new_from_input (CRInput *a_input) ;
enum CRStatus cr_parser_set_tknzr (CRParser *a_this, CRTknzr *a_tknzr) ;
enum CRStatus cr_parser_get_tknzr (CRParser *a_this, CRTknzr **a_tknzr) ;
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_sac_handler (CRParser *a_this,
CRDocHandler *a_handler) ;
enum CRStatus cr_parser_get_sac_handler (CRParser *a_this,
CRDocHandler **a_handler) ;
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 const *a_this,
gboolean *a_use_core_grammar) ;
enum CRStatus cr_parser_parse (CRParser *a_this) ;
enum CRStatus cr_parser_parse_file (CRParser *a_this,
const guchar *a_file_uri,
enum CREncoding a_enc) ;
enum CRStatus cr_parser_parse_buf (CRParser *a_this, const guchar *a_buf,
gulong a_len, enum CREncoding a_enc) ;
enum CRStatus cr_parser_set_default_sac_handler (CRParser *a_this) ;
enum CRStatus cr_parser_parse_term (CRParser *a_this, CRTerm **a_term) ;
enum CRStatus cr_parser_parse_expr (CRParser *a_this, CRTerm **a_expr) ;
enum CRStatus cr_parser_parse_prio (CRParser *a_this, CRString **a_prio) ;
enum CRStatus cr_parser_parse_declaration (CRParser *a_this, CRString **a_property,
CRTerm **a_expr, gboolean *a_important) ;
enum CRStatus cr_parser_parse_statement_core (CRParser *a_this) ;
enum CRStatus cr_parser_parse_ruleset (CRParser *a_this) ;
enum CRStatus cr_parser_parse_import (CRParser *a_this, GList ** a_media_list,
CRString **a_import_string,
CRParsingLocation *a_location) ;
enum CRStatus cr_parser_parse_media (CRParser *a_this) ;
enum CRStatus cr_parser_parse_page (CRParser *a_this) ;
enum CRStatus cr_parser_parse_charset (CRParser *a_this, CRString **a_value,
CRParsingLocation *a_charset_sym_location) ;
enum CRStatus cr_parser_parse_font_face (CRParser *a_this) ;
void cr_parser_destroy (CRParser *a_this) ;
G_END_DECLS
#endif /*__CR_PARSER_H__*/

View File

@ -0,0 +1,70 @@
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli.
* See the COPYRIGHTS file for copyright information.
*/
#ifndef __CR_PARSING_LOCATION_H__
#define __CR_PARSING_LOCATION_H__
#include "cr-utils.h"
G_BEGIN_DECLS
/**
*@file
*The declaration of the CRParsingLocation
*object. This object keeps track of line/column/byte offset/
*at which the parsing of a given CSS construction appears.
*/
typedef struct _CRParsingLocation CRParsingLocation;
struct _CRParsingLocation {
guint line ;
guint column ;
guint byte_offset ;
} ;
enum CRParsingLocationSerialisationMask {
DUMP_LINE = 1,
DUMP_COLUMN = 1 << 1,
DUMP_BYTE_OFFSET = 1 << 2
} ;
CRParsingLocation * cr_parsing_location_new (void) ;
enum CRStatus cr_parsing_location_init (CRParsingLocation *a_this) ;
enum CRStatus cr_parsing_location_copy (CRParsingLocation *a_to,
CRParsingLocation const *a_from) ;
gchar * cr_parsing_location_to_string (CRParsingLocation const *a_this,
enum CRParsingLocationSerialisationMask a_mask) ;
void cr_parsing_location_dump (CRParsingLocation const *a_this,
enum CRParsingLocationSerialisationMask a_mask,
FILE *a_fp) ;
void cr_parsing_location_destroy (CRParsingLocation *a_this) ;
G_END_DECLS
#endif

View File

@ -0,0 +1,80 @@
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli
* See COPYRIGHTS file for copyrights information.
*/
#ifndef __CR_PROP_LIST_H__
#define __CR_PROP_LIST_H__
#include "cr-utils.h"
#include "cr-declaration.h"
#include "cr-string.h"
G_BEGIN_DECLS
typedef struct _CRPropList CRPropList ;
typedef struct _CRPropListPriv CRPropListPriv ;
struct _CRPropList
{
CRPropListPriv * priv;
} ;
CRPropList * cr_prop_list_append (CRPropList *a_this,
CRPropList *a_to_append) ;
CRPropList * cr_prop_list_append2 (CRPropList *a_this,
CRString *a_prop,
CRDeclaration *a_decl) ;
CRPropList * cr_prop_list_prepend (CRPropList *a_this,
CRPropList *a_to_append) ;
CRPropList * cr_prop_list_prepend2 (CRPropList *a_this,
CRString *a_prop,
CRDeclaration *a_decl) ;
enum CRStatus cr_prop_list_set_prop (CRPropList *a_this,
CRString *a_prop) ;
enum CRStatus cr_prop_list_get_prop (CRPropList const *a_this,
CRString **a_prop) ;
enum CRStatus cr_prop_list_lookup_prop (CRPropList *a_this,
CRString *a_prop,
CRPropList**a_pair) ;
CRPropList * cr_prop_list_get_next (CRPropList *a_this) ;
CRPropList * cr_prop_list_get_prev (CRPropList *a_this) ;
enum CRStatus cr_prop_list_set_decl (CRPropList *a_this,
CRDeclaration *a_decl);
enum CRStatus cr_prop_list_get_decl (CRPropList const *a_this,
CRDeclaration **a_decl) ;
CRPropList * cr_prop_list_unlink (CRPropList *a_this,
CRPropList *a_pair) ;
void cr_prop_list_destroy (CRPropList *a_this) ;
G_END_DECLS
#endif /*__CR_PROP_LIST_H__*/

64
node_modules/sharp/vendor/include/libcroco/cr-pseudo.h generated vendored Normal file
View File

@ -0,0 +1,64 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* See COPYRIGHTS file for copyright information
*/
#ifndef __CR_PSEUDO_H__
#define __CR_PSEUDO_H__
#include <stdio.h>
#include <glib.h>
#include "cr-attr-sel.h"
#include "cr-parsing-location.h"
G_BEGIN_DECLS
enum CRPseudoType
{
IDENT_PSEUDO = 0,
FUNCTION_PSEUDO
} ;
typedef struct _CRPseudo CRPseudo ;
/**
*The CRPseudo Class.
*Abstract a "pseudo" as defined by the css2 spec
*in appendix D.1 .
*/
struct _CRPseudo
{
enum CRPseudoType type ;
CRString *name ;
CRString *extra ;
CRParsingLocation location ;
} ;
CRPseudo * cr_pseudo_new (void) ;
guchar * cr_pseudo_to_string (CRPseudo const *a_this) ;
void cr_pseudo_dump (CRPseudo const *a_this, FILE *a_fp) ;
void cr_pseudo_destroy (CRPseudo *a_this) ;
G_END_DECLS
#endif /*__CR_PSEUDO_H__*/

94
node_modules/sharp/vendor/include/libcroco/cr-rgb.h generated vendored Normal file
View File

@ -0,0 +1,94 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* see COPYRIGHTS file for copyright information.
*/
#ifndef __CR_RGB_H__
#define __CR_RGB_H__
#include <stdio.h>
#include <glib.h>
#include "cr-utils.h"
#include "cr-parsing-location.h"
G_BEGIN_DECLS
typedef struct _CRRgb CRRgb ;
struct _CRRgb
{
/*
*the unit of the rgb.
*Either NO_UNIT (integer) or
*UNIT_PERCENTAGE (percentage).
*/
const guchar *name ;
glong red ;
glong green ;
glong blue ;
gboolean is_percentage ;
gboolean inherit ;
gboolean is_transparent ;
CRParsingLocation location ;
} ;
CRRgb * cr_rgb_new (void) ;
CRRgb * cr_rgb_new_with_vals (gulong a_red, gulong a_green,
gulong a_blue, gboolean a_is_percentage) ;
CRRgb *cr_rgb_parse_from_buf(const guchar *a_str,
enum CREncoding a_enc);
enum CRStatus cr_rgb_compute_from_percentage (CRRgb *a_this) ;
enum CRStatus cr_rgb_set (CRRgb *a_this, gulong a_red,
gulong a_green, gulong a_blue,
gboolean a_is_percentage) ;
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 const *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 const *a_rgb) ;
enum CRStatus cr_rgb_set_from_name (CRRgb *a_this, const guchar *a_color_name) ;
enum CRStatus cr_rgb_set_from_hex_str (CRRgb *a_this, const guchar * a_hex_value) ;
struct _CRTerm;
enum CRStatus cr_rgb_set_from_term (CRRgb *a_this, const struct _CRTerm *a_value);
guchar * cr_rgb_to_string (CRRgb const *a_this) ;
void cr_rgb_dump (CRRgb const *a_this, FILE *a_fp) ;
void cr_rgb_destroy (CRRgb *a_this) ;
G_END_DECLS
#endif /*__CR_RGB_H__*/

110
node_modules/sharp/vendor/include/libcroco/cr-sel-eng.h generated vendored Normal file
View File

@ -0,0 +1,110 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli
* See COPYRIGHTS file for copyrights information.
*/
#ifndef __CR_SEL_ENG_H__
#define __CR_SEL_ENG_H__
#include "cr-utils.h"
#include "cr-stylesheet.h"
#include "cr-cascade.h"
#include "cr-style.h"
#include "cr-prop-list.h"
#include <libxml/tree.h>
/**
*@file:
*The declaration of the #CRSelEng class.
*The #CRSelEng is actually the "Selection Engine"
*class.
*/
G_BEGIN_DECLS
typedef struct _CRSelEng CRSelEng ;
typedef struct _CRSelEngPriv CRSelEngPriv ;
/**
*The Selection engine class.
*The main service provided by this class, is
*the ability to interpret a libcroco implementation
*of css2 selectors, and given an xml node, say if
*the selector matches the node or not.
*/
struct _CRSelEng
{
CRSelEngPriv *priv ;
} ;
typedef gboolean (*CRPseudoClassSelectorHandler) (CRSelEng* a_this,
CRAdditionalSel *a_add_sel,
xmlNode *a_node) ;
CRSelEng * cr_sel_eng_new (void) ;
enum CRStatus cr_sel_eng_register_pseudo_class_sel_handler (CRSelEng *a_this,
guchar *a_pseudo_class_sel_name,
enum CRPseudoType a_pseudo_class_type,
CRPseudoClassSelectorHandler a_handler) ;
enum CRStatus cr_sel_eng_unregister_pseudo_class_sel_handler (CRSelEng *a_this,
guchar *a_pseudo_class_sel_name,
enum CRPseudoType a_pseudo_class_type) ;
enum CRStatus cr_sel_eng_unregister_all_pseudo_class_sel_handlers (CRSelEng *a_this) ;
enum CRStatus cr_sel_eng_get_pseudo_class_selector_handler (CRSelEng *a_this,
guchar *a_pseudo_class_sel_name,
enum CRPseudoType a_pseudo_class_type,
CRPseudoClassSelectorHandler *a_handler) ;
enum CRStatus cr_sel_eng_matches_node (CRSelEng *a_this,
CRSimpleSel *a_sel,
xmlNode *a_node,
gboolean *a_result) ;
enum CRStatus cr_sel_eng_get_matched_rulesets (CRSelEng *a_this,
CRStyleSheet *a_sheet,
xmlNode *a_node,
CRStatement ***a_rulesets,
gulong *a_len) ;
enum CRStatus
cr_sel_eng_get_matched_properties_from_cascade (CRSelEng *a_this,
CRCascade *a_cascade,
xmlNode *a_node,
CRPropList **a_props) ;
enum CRStatus cr_sel_eng_get_matched_style (CRSelEng *a_this,
CRCascade *a_cascade,
xmlNode *a_node,
CRStyle *a_parent_style,
CRStyle **a_style,
gboolean a_set_props_to_initial_values) ;
void cr_sel_eng_destroy (CRSelEng *a_this) ;
G_END_DECLS
#endif/*__CR_SEL_ENG_H__*/

View File

@ -0,0 +1,95 @@
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
*
* Author: Dodji Seketeli
* See COPYRIGHTS file for copyright information.
*/
#ifndef __CR_SELECTOR_H__
#define __CR_SELECTOR_H__
#include <stdio.h>
#include "cr-utils.h"
#include "cr-simple-sel.h"
#include "cr-parsing-location.h"
/**
*@file
*The declaration file of the #CRSelector file.
*/
G_BEGIN_DECLS
typedef struct _CRSelector CRSelector ;
/**
*Abstracts a CSS2 selector as defined in the right part
*of the 'ruleset" production in the appendix D.1 of the
*css2 spec.
*It is actually the abstraction of a comma separated list
*of simple selectors list.
*In a css2 file, a selector is a list of simple selectors
*separated by a comma.
*e.g: sel0, sel1, sel2 ...
*Each seln is a simple selector
*/
struct _CRSelector
{
/**
*A Selection expression.
*It is a list of basic selectors.
*Each basic selector can be either an element
*selector, an id selector, a class selector, an
*attribute selector, an universal selector etc ...
*/
CRSimpleSel *simple_sel ;
/**The next selector list element*/
CRSelector *next ;
CRSelector *prev ;
CRParsingLocation location ;
glong ref_count ;
};
CRSelector* cr_selector_new (CRSimpleSel *a_sel_expr) ;
CRSelector * cr_selector_parse_from_buf (const guchar * a_char_buf,
enum CREncoding a_enc) ;
CRSelector* cr_selector_append (CRSelector *a_this, CRSelector *a_new) ;
CRSelector* cr_selector_append_simple_sel (CRSelector *a_this,
CRSimpleSel *a_simple_sel) ;
CRSelector* cr_selector_prepend (CRSelector *a_this, CRSelector *a_new) ;
guchar * cr_selector_to_string (CRSelector const *a_this) ;
void cr_selector_dump (CRSelector const *a_this, FILE *a_fp) ;
void cr_selector_ref (CRSelector *a_this) ;
gboolean cr_selector_unref (CRSelector *a_this) ;
void cr_selector_destroy (CRSelector *a_this) ;
G_END_DECLS
#endif /*__CR_SELECTOR_H__*/

View File

@ -0,0 +1,130 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli
* See COPYRIGHTS file for copyright information.
*/
#ifndef __CR_SEL_H__
#define __CR_SEL_H__
#include <stdio.h>
#include <glib.h>
#include "cr-additional-sel.h"
#include "cr-parsing-location.h"
G_BEGIN_DECLS
/**
*@file
*the declaration of the #CRSimpleSel class.
*
*/
enum Combinator
{
NO_COMBINATOR,
COMB_WS,/*whitespace: descendent*/
COMB_PLUS,/*'+': preceded by*/
COMB_GT/*greater than ('>'): child*/
} ;
enum SimpleSelectorType
{
NO_SELECTOR_TYPE = 0,
UNIVERSAL_SELECTOR = 1,
TYPE_SELECTOR = 1 << 1
} ;
typedef struct _CRSimpleSel CRSimpleSel ;
/**
*The abstraction of a css2 simple selection list
*as defined by the right part of the "selector" production in the
*appendix D.1 of the css2 spec.
*It is basically a list of simple selector, each
*simple selector being separated by a combinator.
*
*In the libcroco's implementation, each simple selector
*is made of at most two parts:
*
*1/An element name or 'type selector' (which can hold a '*' and
*then been called 'universal selector')
*
*2/An additional selector that "specializes" the preceding type or
*universal selector. The additionnal selector can be either
*an id selector, or a class selector, or an attribute selector.
*/
struct _CRSimpleSel
{
enum SimpleSelectorType type_mask ;
gboolean is_case_sentive ;
CRString * name ;
/**
*The combinator that separates
*this simple selector from the previous
*one.
*/
enum Combinator combinator ;
/**
*The additional selector list of the
*current simple selector.
*An additional selector may
*be a class selector, an id selector,
*or an attribute selector.
*Note that this field is a linked list.
*/
CRAdditionalSel *add_sel ;
/*
*the specificity as specified by
*chapter 6.4.3 of the spec.
*/
gulong specificity ;
CRSimpleSel *next ;
CRSimpleSel *prev ;
CRParsingLocation location ;
} ;
CRSimpleSel * cr_simple_sel_new (void) ;
CRSimpleSel * cr_simple_sel_append_simple_sel (CRSimpleSel *a_this,
CRSimpleSel *a_sel) ;
CRSimpleSel * cr_simple_sel_prepend_simple_sel (CRSimpleSel *a_this,
CRSimpleSel *a_sel) ;
guchar * cr_simple_sel_to_string (CRSimpleSel const *a_this) ;
guchar * cr_simple_sel_one_to_string (CRSimpleSel const * a_this) ;
enum CRStatus cr_simple_sel_dump (CRSimpleSel const *a_this, FILE *a_fp) ;
enum CRStatus cr_simple_sel_dump_attr_sel_list (CRSimpleSel const *a_this) ;
enum CRStatus cr_simple_sel_compute_specificity (CRSimpleSel *a_this) ;
void cr_simple_sel_destroy (CRSimpleSel *a_this) ;
G_END_DECLS
#endif /*__CR_SIMPLE_SEL_H__*/

View File

@ -0,0 +1,440 @@
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli
* See COPYRIGHTS file for copyright information.
*/
#include <stdio.h>
#include "cr-utils.h"
#include "cr-term.h"
#include "cr-selector.h"
#include "cr-declaration.h"
#ifndef __CR_STATEMENT_H__
#define __CR_STATEMENT_H__
G_BEGIN_DECLS
/**
*@file
*Declaration of the #CRStatement class.
*/
/*
*forward declaration of CRStyleSheet which is defined in
*cr-stylesheet.h
*/
struct _CRStatement ;
/*
*typedef struct _CRStatement CRStatement ;
*this is forward declared in
*cr-declaration.h already.
*/
struct _CRAtMediaRule ;
typedef struct _CRAtMediaRule CRAtMediaRule ;
typedef struct _CRRuleSet CRRuleSet ;
/**
*The abstraction of a css ruleset.
*A ruleset is made of a list of selectors,
*followed by a list of declarations.
*/
struct _CRRuleSet
{
/**A list of instances of #CRSimpeSel*/
CRSelector *sel_list ;
/**A list of instances of #CRDeclaration*/
CRDeclaration *decl_list ;
/**
*The parent media rule, or NULL if
*no parent media rule exists.
*/
CRStatement *parent_media_rule ;
} ;
/*
*a forward declaration of CRStylesheet.
*CRStylesheet is actually declared in
*cr-stylesheet.h
*/
struct _CRStyleSheet ;
typedef struct _CRStyleSheet CRStyleSheet;
/**The \@import rule abstraction.*/
typedef struct _CRAtImportRule CRAtImportRule ;
struct _CRAtImportRule
{
/**the url of the import rule*/
CRString *url ;
GList *media_list ;
/**
*the stylesheet fetched from the url, if any.
*this is not "owned" by #CRAtImportRule which means
*it is not destroyed by the destructor of #CRAtImportRule.
*/
CRStyleSheet * sheet;
};
/**abstraction of an \@media rule*/
struct _CRAtMediaRule
{
GList *media_list ;
CRStatement *rulesets ;
} ;
typedef struct _CRAtPageRule CRAtPageRule ;
/**The \@page rule abstraction*/
struct _CRAtPageRule
{
/**a list of instances of #CRDeclaration*/
CRDeclaration *decl_list ;
/**page selector. Is a pseudo selector*/
CRString *name ;
CRString *pseudo ;
} ;
/**The \@charset rule abstraction*/
typedef struct _CRAtCharsetRule CRAtCharsetRule ;
struct _CRAtCharsetRule
{
CRString * charset ;
};
/**The abstaction of the \@font-face rule.*/
typedef struct _CRAtFontFaceRule CRAtFontFaceRule ;
struct _CRAtFontFaceRule
{
/*a list of instanaces of #CRDeclaration*/
CRDeclaration *decl_list ;
} ;
/**
*The possible types of css2 statements.
*/
enum CRStatementType
{
/**
*A generic css at-rule
*each unknown at-rule will
*be of this type.
*/
/**A css at-rule*/
AT_RULE_STMT = 0,
/*A css ruleset*/
RULESET_STMT,
/**A css2 import rule*/
AT_IMPORT_RULE_STMT,
/**A css2 media rule*/
AT_MEDIA_RULE_STMT,
/**A css2 page rule*/
AT_PAGE_RULE_STMT,
/**A css2 charset rule*/
AT_CHARSET_RULE_STMT,
/**A css2 font face rule*/
AT_FONT_FACE_RULE_STMT
} ;
/**
*The abstraction of css statement as defined
*in the chapter 4 and appendix D.1 of the css2 spec.
*A statement is actually a double chained list of
*statements.A statement can be a ruleset, an \@import
*rule, an \@page rule etc ...
*/
struct _CRStatement
{
/**
*The type of the statement.
*/
enum CRStatementType type ;
union
{
CRRuleSet *ruleset ;
CRAtImportRule *import_rule ;
CRAtMediaRule *media_rule ;
CRAtPageRule *page_rule ;
CRAtCharsetRule *charset_rule ;
CRAtFontFaceRule *font_face_rule ;
} kind ;
/*
*the specificity of the selector
*that matched this statement.
*This is only used by the cascading
*order determination algorithm.
*/
gulong specificity ;
/*
*the style sheet that contains
*this css statement.
*/
CRStyleSheet *parent_sheet ;
CRStatement *next ;
CRStatement *prev ;
CRParsingLocation location ;
/**
*a custom pointer useable by
*applications that use libcroco.
*libcroco itself will never modify
*this pointer.
*/
gpointer app_data ;
/**
*a custom pointer used
*by the upper layers of libcroco.
*application should never use this
*pointer.
*/
gpointer croco_data ;
} ;
gboolean
cr_statement_does_buf_parses_against_core (const guchar *a_buf,
enum CREncoding a_encoding) ;
CRStatement *
cr_statement_parse_from_buf (const guchar *a_buf,
enum CREncoding a_encoding) ;
CRStatement*
cr_statement_new_ruleset (CRStyleSheet *a_sheet,
CRSelector *a_sel_list,
CRDeclaration *a_decl_list,
CRStatement *a_media_rule) ;
CRStatement *
cr_statement_ruleset_parse_from_buf (const guchar * a_buf,
enum CREncoding a_enc) ;
CRStatement*
cr_statement_new_at_import_rule (CRStyleSheet *a_container_sheet,
CRString *a_url,
GList *a_media_list,
CRStyleSheet *a_imported_sheet) ;
CRStatement *
cr_statement_at_import_rule_parse_from_buf (const guchar * a_buf,
enum CREncoding a_encoding) ;
CRStatement *
cr_statement_new_at_media_rule (CRStyleSheet *a_sheet,
CRStatement *a_ruleset,
GList *a_media) ;
CRStatement *
cr_statement_at_media_rule_parse_from_buf (const guchar *a_buf,
enum CREncoding a_enc) ;
CRStatement *
cr_statement_new_at_charset_rule (CRStyleSheet *a_sheet,
CRString *a_charset) ;
CRStatement *
cr_statement_at_charset_rule_parse_from_buf (const guchar *a_buf,
enum CREncoding a_encoding);
CRStatement *
cr_statement_new_at_font_face_rule (CRStyleSheet *a_sheet,
CRDeclaration *a_font_decls) ;
CRStatement *
cr_statement_font_face_rule_parse_from_buf (const guchar *a_buf,
enum CREncoding a_encoding) ;
CRStatement *
cr_statement_new_at_page_rule (CRStyleSheet *a_sheet,
CRDeclaration *a_decl_list,
CRString *a_name,
CRString *a_pseudo) ;
CRStatement *
cr_statement_at_page_rule_parse_from_buf (const guchar *a_buf,
enum CREncoding a_encoding) ;
enum CRStatus
cr_statement_set_parent_sheet (CRStatement *a_this,
CRStyleSheet *a_sheet) ;
enum CRStatus
cr_statement_get_parent_sheet (CRStatement *a_this,
CRStyleSheet **a_sheet) ;
CRStatement *
cr_statement_append (CRStatement *a_this,
CRStatement *a_new) ;
CRStatement*
cr_statement_prepend (CRStatement *a_this,
CRStatement *a_new) ;
CRStatement *
cr_statement_unlink (CRStatement *a_stmt) ;
enum CRStatus
cr_statement_ruleset_set_sel_list (CRStatement *a_this,
CRSelector *a_sel_list) ;
enum CRStatus
cr_statement_ruleset_get_sel_list (CRStatement const *a_this,
CRSelector **a_list) ;
enum CRStatus
cr_statement_ruleset_set_decl_list (CRStatement *a_this,
CRDeclaration *a_list) ;
enum CRStatus
cr_statement_ruleset_get_declarations (CRStatement *a_this,
CRDeclaration **a_decl_list) ;
enum CRStatus
cr_statement_ruleset_append_decl2 (CRStatement *a_this,
CRString *a_prop, CRTerm *a_value) ;
enum CRStatus
cr_statement_ruleset_append_decl (CRStatement *a_this,
CRDeclaration *a_decl) ;
enum CRStatus
cr_statement_at_import_rule_set_imported_sheet (CRStatement *a_this,
CRStyleSheet *a_sheet) ;
enum CRStatus
cr_statement_at_import_rule_get_imported_sheet (CRStatement *a_this,
CRStyleSheet **a_sheet) ;
enum CRStatus
cr_statement_at_import_rule_set_url (CRStatement *a_this,
CRString *a_url) ;
enum CRStatus
cr_statement_at_import_rule_get_url (CRStatement const *a_this,
CRString **a_url) ;
gint
cr_statement_at_media_nr_rules (CRStatement const *a_this) ;
CRStatement *
cr_statement_at_media_get_from_list (CRStatement *a_this, int itemnr) ;
enum CRStatus
cr_statement_at_page_rule_set_sel (CRStatement *a_this,
CRSelector *a_sel) ;
enum CRStatus
cr_statement_at_page_rule_get_sel (CRStatement const *a_this,
CRSelector **a_sel) ;
enum CRStatus
cr_statement_at_page_rule_set_declarations (CRStatement *a_this,
CRDeclaration *a_decl_list) ;
enum CRStatus
cr_statement_at_page_rule_get_declarations (CRStatement *a_this,
CRDeclaration **a_decl_list) ;
enum CRStatus
cr_statement_at_charset_rule_set_charset (CRStatement *a_this,
CRString *a_charset) ;
enum CRStatus
cr_statement_at_charset_rule_get_charset (CRStatement const *a_this,
CRString **a_charset) ;
enum CRStatus
cr_statement_at_font_face_rule_set_decls (CRStatement *a_this,
CRDeclaration *a_decls) ;
enum CRStatus
cr_statement_at_font_face_rule_get_decls (CRStatement *a_this,
CRDeclaration **a_decls) ;
enum CRStatus
cr_statement_at_font_face_rule_add_decl (CRStatement *a_this,
CRString *a_prop,
CRTerm *a_value) ;
gchar *
cr_statement_to_string (CRStatement const * a_this, gulong a_indent) ;
gchar*
cr_statement_list_to_string (CRStatement const *a_this, gulong a_indent) ;
void
cr_statement_dump (CRStatement const *a_this, FILE *a_fp, gulong a_indent) ;
void
cr_statement_dump_ruleset (CRStatement const * a_this, FILE * a_fp,
glong a_indent) ;
void
cr_statement_dump_font_face_rule (CRStatement const * a_this,
FILE * a_fp,
glong a_indent) ;
void
cr_statement_dump_page (CRStatement const * a_this, FILE * a_fp,
gulong a_indent) ;
void
cr_statement_dump_media_rule (CRStatement const * a_this,
FILE * a_fp,
gulong a_indent) ;
void
cr_statement_dump_import_rule (CRStatement const * a_this, FILE * a_fp,
gulong a_indent) ;
void
cr_statement_dump_charset (CRStatement const * a_this, FILE * a_fp,
gulong a_indent) ;
gint
cr_statement_nr_rules (CRStatement const *a_this) ;
CRStatement *
cr_statement_get_from_list (CRStatement *a_this, int itemnr) ;
void
cr_statement_destroy (CRStatement *a_this) ;
G_END_DECLS
#endif /*__CR_STATEMENT_H__*/

76
node_modules/sharp/vendor/include/libcroco/cr-string.h generated vendored Normal file
View File

@ -0,0 +1,76 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* See COPYRIGHTS file for copyright information.
*/
/**
*@file
*Declaration file of the #CRString class.
*/
#ifndef __CR_STRING_H__
#define __CR_STRING_H__
#include <glib.h>
#include "cr-utils.h"
#include "cr-parsing-location.h"
G_BEGIN_DECLS
typedef struct _CRString CRString ;
/**
*This is a ship implementation of string based on GString.
*Actually, the aim of CRString is to store the parsing location
*(line,column,byte offset) at which a given string has been parsed
*in the input CSS.
*So this class has a gstring field of type GString that users can
*freely manipulate, and also a CRParginLocation type where the
*parsing location is store. If you don't want to deal with parsing
*location stuffs, then use GString instead. If we were in C++ for example,
*CRString would just inherit GString and just add accessors to
*the CRParsingLocation data ... but we are not and we still have
*to provide the parsing location information.
*/
struct _CRString {
/**
*The GString where all the string
*operation happen.
*/
GString *stryng ;
/**
*The parsing location storage area.
*/
CRParsingLocation location ;
} ;
CRString * cr_string_new (void) ;
CRString *cr_string_new_from_string (const gchar * a_string) ;
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
#endif

339
node_modules/sharp/vendor/include/libcroco/cr-style.h generated vendored Normal file
View File

@ -0,0 +1,339 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
/*
* This file is part of The Croco Library
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli.
* See COPYRIGHTS file for copyright information.
*/
#ifndef __CR_STYLE_H__
#define __CR_STYLE_H__
#include "cr-utils.h"
#include "cr-statement.h"
#include "cr-fonts.h"
/**
*@file
*The declaration of the #CRStyle class.
*/
G_BEGIN_DECLS
typedef struct _CRStyle CRStyle ;
enum CRBorderStyle
{
BORDER_STYLE_NONE = 0,
BORDER_STYLE_HIDDEN,
BORDER_STYLE_DOTTED,
BORDER_STYLE_DASHED,
BORDER_STYLE_SOLID,
BORDER_STYLE_DOUBLE,
BORDER_STYLE_GROOVE,
BORDER_STYLE_RIDGE,
BORDER_STYLE_INSET,
BORDER_STYLE_OUTSET,
BORDER_STYLE_INHERIT
} ;
enum CRDisplayType
{
DISPLAY_NONE,
DISPLAY_INLINE,
DISPLAY_BLOCK,
DISPLAY_LIST_ITEM,
DISPLAY_RUN_IN,
DISPLAY_COMPACT,
DISPLAY_MARKER,
DISPLAY_TABLE,
DISPLAY_INLINE_TABLE,
DISPLAY_TABLE_ROW_GROUP,
DISPLAY_TABLE_HEADER_GROUP,
DISPLAY_TABLE_FOOTER_GROUP,
DISPLAY_TABLE_ROW,
DISPLAY_TABLE_COLUMN_GROUP,
DISPLAY_TABLE_COLUMN,
DISPLAY_TABLE_CELL,
DISPLAY_TABLE_CAPTION,
DISPLAY_INHERIT
} ;
enum CRPositionType
{
POSITION_STATIC,
POSITION_RELATIVE,
POSITION_ABSOLUTE,
POSITION_FIXED,
POSITION_INHERIT
} ;
enum CRFloatType
{
FLOAT_NONE,
FLOAT_LEFT,
FLOAT_RIGHT,
FLOAT_INHERIT
} ;
enum CRWhiteSpaceType
{
WHITE_SPACE_NORMAL,
WHITE_SPACE_PRE,
WHITE_SPACE_NOWRAP,
WHITE_SPACE_INHERIT
} ;
#define BORDER_THIN 2
#define BORDER_MEDIUM 4
#define BORDER_THICK 6
/**
*A numerical css property value.
*This data type is actually split in 3 parts:
*1/the specified value
*2/the computed value
*3/the actual value.
*To understand the semantic of these three parts,
*see css2 spec chap 6.1 ("Specified, computed and actual values.").
*/
typedef struct _CRNumPropVal CRNumPropVal ;
struct _CRNumPropVal
{
/**specified value*/
CRNum sv ;
/**computed value*/
CRNum cv ;
/**actual value*/
CRNum av ;
} ;
/**
*An rgb css property value.
*This data type is actually split in 3 parts:
*1/the specified value
*2/the computed value
*3/the actual value.
*To understand the semantic of these three parts,
*see css2 spec chap 6.1 ("Specified, computed and actual values.").
*/
typedef struct _CRRgbPropVal CRRgbPropVal ;
struct _CRRgbPropVal
{
/**specified value*/
CRRgb sv ;
/**computed value*/
CRRgb cv ;
/**actual value*/
CRRgb av ;
} ;
enum CRNumProp
{
NUM_PROP_TOP=0,
NUM_PROP_RIGHT,
NUM_PROP_BOTTOM,
NUM_PROP_LEFT,/*3*/
NUM_PROP_PADDING_TOP,
NUM_PROP_PADDING_RIGHT,
NUM_PROP_PADDING_BOTTOM,
NUM_PROP_PADDING_LEFT,/*7*/
NUM_PROP_BORDER_TOP,
NUM_PROP_BORDER_RIGHT,
NUM_PROP_BORDER_BOTTOM,
NUM_PROP_BORDER_LEFT,/*11*/
NUM_PROP_MARGIN_TOP,
NUM_PROP_MARGIN_RIGHT,
NUM_PROP_MARGIN_BOTTOM,
NUM_PROP_MARGIN_LEFT,/*15*/
NUM_PROP_WIDTH,
/*must be last*/
NB_NUM_PROPS
} ;
enum CRRgbProp
{
RGB_PROP_BORDER_TOP_COLOR = 0,
RGB_PROP_BORDER_RIGHT_COLOR,
RGB_PROP_BORDER_BOTTOM_COLOR,
RGB_PROP_BORDER_LEFT_COLOR,
RGB_PROP_COLOR,
RGB_PROP_BACKGROUND_COLOR,
/*must be last*/
NB_RGB_PROPS
} ;
enum CRBorderStyleProp
{
BORDER_STYLE_PROP_TOP = 0,
BORDER_STYLE_PROP_RIGHT,
BORDER_STYLE_PROP_BOTTOM,
BORDER_STYLE_PROP_LEFT,
/*must be last*/
NB_BORDER_STYLE_PROPS
} ;
enum CRBoxOffsetProp
{
BOX_OFFSET_PROP_TOP = 0,
BOX_OFFSET_PROP_RIGHT,
BOX_OFFSET_PROP_BOTTOM,
BOX_OFFSET_PROP_LEFT,
/*must be last*/
NB_BOX_OFFSET_PROPS
} ;
typedef struct _CRFontSizeVal CRFontSizeVal ;
struct _CRFontSizeVal {
/*specified value*/
CRFontSize sv ;
/*computed value*/
CRFontSize cv ;
/*actual value*/
CRFontSize av ;
} ;
/**
*The css2 style class.
*Contains computed and actual values
*inferred from the declarations found
*in the stylesheets.
*See css2 spec chapter 6.
*/
struct _CRStyle
{
/**
*numerical properties.
*the properties are indexed by
*enum #CRNumProp.
*/
CRNumPropVal num_props[NB_NUM_PROPS] ;
/**
*color properties.
*They are indexed by enum #CRRgbProp .
*/
CRRgbPropVal rgb_props[NB_RGB_PROPS] ;
/**
*border style properties.
*They are indexed by enum #CRBorderStyleProp .
*/
enum CRBorderStyle border_style_props[NB_BORDER_STYLE_PROPS] ;
/**box display type*/
enum CRDisplayType display ;
/**the positioning scheme*/
enum CRPositionType position ;
/**the float property*/
enum CRFloatType float_type ;
/*
*the 'font-family' property.
*/
CRFontFamily *font_family ;
/**
*the 'font-size' property.
*/
CRFontSizeVal font_size ;
CRFontSizeAdjust *font_size_adjust ;
enum CRFontStyle font_style ;
enum CRFontVariant font_variant ;
enum CRFontWeight font_weight ;
enum CRFontStretch font_stretch ;
/**
* the 'tex' properties
*/
enum CRWhiteSpaceType white_space;
gboolean inherited_props_resolved ;
CRStyle *parent_style ;
gulong ref_count ;
} ;
enum CRStatus cr_style_white_space_type_to_string (enum CRWhiteSpaceType a_code,
GString * a_str, guint a_nb_indent) ;
enum CRStatus cr_style_num_prop_val_to_string (CRNumPropVal *a_prop_val,
GString *a_str,
guint a_nb_indent) ;
enum CRStatus cr_style_rgb_prop_val_to_string (CRRgbPropVal *a_prop_val,
GString *a_str,
guint a_nb_indent) ;
enum CRStatus cr_style_border_style_to_string (enum CRBorderStyle a_prop,
GString *a_str,
guint a_nb_indent) ;
enum CRStatus cr_style_display_type_to_string (enum CRDisplayType a_code,
GString *a_str,
guint a_nb_indent) ;
enum CRStatus cr_style_position_type_to_string (enum CRPositionType a_code,
GString *a_str,
guint a_nb_indent) ;
enum CRStatus cr_style_float_type_to_string (enum CRFloatType a_code,
GString *a_str,
guint a_nb_indent) ;
CRStyle * cr_style_new (gboolean a_set_props_to_initial_values) ;
enum CRStatus cr_style_set_props_to_default_values (CRStyle *a_this) ;
enum CRStatus cr_style_set_props_to_initial_values (CRStyle *a_this) ;
enum CRStatus cr_style_resolve_inherited_properties (CRStyle *a_this) ;
enum CRStatus cr_style_propagate_from_parent (CRStyle *a_this);
enum CRStatus cr_style_set_style_from_decl (CRStyle *a_this,
CRDeclaration *a_decl) ;
enum CRStatus cr_style_copy (CRStyle *a_dest, CRStyle *a_src) ;
enum CRStatus cr_style_ref (CRStyle *a_this) ;
gboolean cr_style_unref (CRStyle *a_this) ;
void cr_style_destroy (CRStyle *a_this) ;
CRStyle * cr_style_dup (CRStyle *a_this) ;
enum CRStatus cr_style_to_string (CRStyle *a_this,
GString **a_str,
guint a_nb_indent) ;
G_END_DECLS
#endif /*__CR_STYLE_H__*/

View File

@ -0,0 +1,102 @@
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* see COPYRIGHTS file for copyright information.
*/
#ifndef __CR_STYLESHEET_H__
#define __CR_STYLESHEET_H__
#include "cr-utils.h"
#include "cr-statement.h"
G_BEGIN_DECLS
/**
*@file
*The declaration of the #CRStyleSheet class.
*/
enum CRStyleOrigin
{
/*Please don't change the order of
*the values enumerated here ...
*New values should be added at the end,
*just before ORIGIN_END.
*/
ORIGIN_UA = 0,
ORIGIN_USER,
ORIGIN_AUTHOR,
/*must always be the last one*/
NB_ORIGINS
} ;
/**
*An abstraction of a css stylesheet as defined
*by the css2 spec in chapter 4.
*/
struct _CRStyleSheet
{
/**The css statements list*/
CRStatement *statements ;
enum CRStyleOrigin origin ;
/*the parent import rule, if any.*/
CRStatement *parent_import_rule ;
/**custom data used by libcroco*/
gpointer croco_data ;
/**
*custom application data pointer
*Can be used by applications.
*/
gpointer app_data ;
/**
*the reference count of this insance
*Please, don't never ever modify it
*directly. Use cr_stylesheet_ref()
*and cr_stylesheet_unref() instead.
*/
gulong ref_count ;
} ;
CRStyleSheet * cr_stylesheet_new (CRStatement *a_stmts) ;
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 const *a_this) ;
CRStatement * cr_stylesheet_statement_get_from_list (CRStyleSheet *a_this, int itemnr) ;
void cr_stylesheet_ref (CRStyleSheet *a_this) ;
gboolean cr_stylesheet_unref (CRStyleSheet *a_this) ;
void cr_stylesheet_destroy (CRStyleSheet *a_this) ;
G_END_DECLS
#endif /*__CR_STYLESHEET_H__*/

190
node_modules/sharp/vendor/include/libcroco/cr-term.h generated vendored Normal file
View File

@ -0,0 +1,190 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli
* See COPYRIGHTS file for copyright information.
*/
#include <stdio.h>
#include <glib.h>
#include "cr-utils.h"
#include "cr-rgb.h"
#include "cr-num.h"
#include "cr-string.h"
#ifndef __CR_TERM_H__
#define __CR_TERM_H__
G_BEGIN_DECLS
/**
*@file
*Declaration of the #CRTem class.
*/
enum CRTermType
{
TERM_NO_TYPE = 0,
TERM_NUMBER,
TERM_FUNCTION,
TERM_STRING,
TERM_IDENT,
TERM_URI,
TERM_RGB,
TERM_UNICODERANGE,
TERM_HASH
} ;
enum UnaryOperator
{
NO_UNARY_UOP = 0,
PLUS_UOP,
MINUS_UOP,
EMPTY_UNARY_UOP
} ;
enum Operator
{
NO_OP = 0,
DIVIDE,
COMMA
} ;
struct _CRTerm ;
typedef struct _CRTerm CRTerm ;
/**
*An abstraction of a css2 term as
*defined in the CSS2 spec in appendix D.1:
*term ::=
*[ NUMBER S* | PERCENTAGE S* | LENGTH S* | EMS S* | EXS S*
*| ANGLE S* | TIME S* | FREQ S* | function ]
* | STRING S* | IDENT S* | URI S* | RGB S*
*| UNICODERANGE S* | hexcolor
*/
struct _CRTerm
{
/**
*The type of the term.
*/
enum CRTermType type ;
/**
*The unary operator associated to
*the current term.
*/
enum UnaryOperator unary_op ;
/**
*The operator associated to the current term.
*/
enum Operator the_operator ;
/**
*The content of the term.
*Depending of the type of the term,
*this holds either a number, a percentage ...
*/
union
{
CRNum *num ;
CRString * str ;
CRRgb * rgb ;
} content ;
/**
*If the term is of type UNICODERANGE,
*this field holds the upper bound of the range.
*if the term is of type FUNCTION, this holds
*an instance of CRTerm that represents
* the expression which is the argument of the function.
*/
union
{
CRTerm *func_param ;
} ext_content ;
/**
*A spare pointer, just in case.
*Can be used by the application.
*/
gpointer app_data ;
glong ref_count ;
/**
*A pointer to the next term,
*just in case this term is part of
*an expression.
*/
CRTerm *next ;
/**
*A pointer to the previous
*term.
*/
CRTerm *prev ;
CRParsingLocation location ;
} ;
CRTerm * cr_term_parse_expression_from_buf (const guchar *a_buf,
enum CREncoding a_encoding) ;
CRTerm * cr_term_new (void) ;
enum CRStatus cr_term_set_number (CRTerm *a_this, CRNum *a_num) ;
enum CRStatus cr_term_set_function (CRTerm *a_this,
CRString *a_func_name,
CRTerm *a_func_param) ;
enum CRStatus cr_term_set_string (CRTerm *a_this, CRString *a_str) ;
enum CRStatus cr_term_set_ident (CRTerm *a_this, CRString *a_str) ;
enum CRStatus cr_term_set_uri (CRTerm *a_this, CRString *a_str) ;
enum CRStatus cr_term_set_rgb (CRTerm *a_this, CRRgb *a_rgb) ;
enum CRStatus cr_term_set_hash (CRTerm *a_this, CRString *a_str) ;
CRTerm * cr_term_append_term (CRTerm *a_this, CRTerm *a_new_term) ;
CRTerm * cr_term_prepend_term (CRTerm *a_this, CRTerm *a_new_term) ;
guchar * cr_term_to_string (CRTerm const *a_this) ;
guchar * cr_term_one_to_string (CRTerm const * a_this) ;
void cr_term_dump (CRTerm const *a_this, FILE *a_fp) ;
int cr_term_nr_values (CRTerm const *a_this) ;
CRTerm * cr_term_get_from_list (CRTerm *a_this, int itemnr) ;
void cr_term_ref (CRTerm *a_this) ;
gboolean cr_term_unref (CRTerm *a_this) ;
void cr_term_destroy (CRTerm * a_term) ;
G_END_DECLS
#endif /*__CR_TERM_H__*/

115
node_modules/sharp/vendor/include/libcroco/cr-tknzr.h generated vendored Normal file
View File

@ -0,0 +1,115 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli
* See COPYRIGHTS file for coypyright information.
*/
/**
*@file
*The declaration of the #CRTknzr (tokenizer)
*class.
*/
#ifndef __CR_TKNZR_H__
#define __CR_TKNZR_H__
#include "cr-utils.h"
#include "cr-input.h"
#include "cr-token.h"
G_BEGIN_DECLS
typedef struct _CRTknzr CRTknzr ;
typedef struct _CRTknzrPriv CRTknzrPriv ;
/**
*The tokenizer is the class that knows
*about all the css token. Its main job is
*to return the next token found in the character
*input stream.
*/
struct _CRTknzr
{
/*the private data of the tokenizer.*/
CRTknzrPriv *priv ;
} ;
CRTknzr * cr_tknzr_new (CRInput *a_input) ;
CRTknzr * cr_tknzr_new_from_uri (const guchar *a_file_uri,
enum CREncoding a_enc) ;
CRTknzr * cr_tknzr_new_from_buf (guchar *a_buf, gulong a_len,
enum CREncoding a_enc,
gboolean a_free_at_destroy) ;
gboolean cr_tknzr_unref (CRTknzr *a_this) ;
void cr_tknzr_ref (CRTknzr *a_this) ;
enum CRStatus cr_tknzr_read_byte (CRTknzr *a_this, guchar *a_byte) ;
enum CRStatus cr_tknzr_read_char (CRTknzr *a_this, guint32 *a_char);
enum CRStatus cr_tknzr_peek_char (CRTknzr *a_this, guint32 *a_char) ;
enum CRStatus cr_tknzr_peek_byte (CRTknzr *a_this, gulong a_offset,
guchar *a_byte) ;
guchar cr_tknzr_peek_byte2 (CRTknzr *a_this, gulong a_offset,
gboolean *a_eof) ;
enum CRStatus cr_tknzr_set_cur_pos (CRTknzr *a_this, CRInputPos *a_pos) ;
glong cr_tknzr_get_nb_bytes_left (CRTknzr *a_this) ;
enum CRStatus cr_tknzr_get_cur_pos (CRTknzr *a_this, CRInputPos *a_pos) ;
enum CRStatus cr_tknzr_get_parsing_location (CRTknzr *a_this,
CRParsingLocation *a_loc) ;
enum CRStatus cr_tknzr_seek_index (CRTknzr *a_this,
enum CRSeekPos a_origin,
gint a_pos) ;
enum CRStatus cr_tknzr_get_cur_byte_addr (CRTknzr *a_this, guchar **a_addr) ;
enum CRStatus cr_tknzr_consume_chars (CRTknzr *a_this, guint32 a_char,
glong *a_nb_char) ;
enum CRStatus cr_tknzr_get_next_token (CRTknzr *a_this, CRToken ** a_tk) ;
enum CRStatus cr_tknzr_unget_token (CRTknzr *a_this, CRToken *a_token) ;
enum CRStatus cr_tknzr_parse_token (CRTknzr *a_this, enum CRTokenType a_type,
enum CRTokenExtraType a_et, gpointer a_res,
gpointer a_extra_res) ;
enum CRStatus cr_tknzr_set_input (CRTknzr *a_this, CRInput *a_input) ;
enum CRStatus cr_tknzr_get_input (CRTknzr *a_this, CRInput **a_input) ;
void cr_tknzr_destroy (CRTknzr *a_this) ;
G_END_DECLS
#endif /*__CR_TKZNR_H__*/

212
node_modules/sharp/vendor/include/libcroco/cr-token.h generated vendored Normal file
View File

@ -0,0 +1,212 @@
/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli
* See COPYRIGHTS file for copyright information.
*/
#ifndef __CR_TOKEN_H__
#define __CR_TOKEN_H__
#include "cr-utils.h"
#include "cr-input.h"
#include "cr-num.h"
#include "cr-rgb.h"
#include "cr-string.h"
#include "cr-parsing-location.h"
G_BEGIN_DECLS
enum CRTokenType
{
NO_TK,
S_TK,
CDO_TK,
CDC_TK,
INCLUDES_TK,
DASHMATCH_TK,
COMMENT_TK,
STRING_TK,
IDENT_TK,
HASH_TK,
IMPORT_SYM_TK,
PAGE_SYM_TK,
MEDIA_SYM_TK,
FONT_FACE_SYM_TK,
CHARSET_SYM_TK,
ATKEYWORD_TK,
IMPORTANT_SYM_TK,
EMS_TK,
EXS_TK,
LENGTH_TK,
ANGLE_TK,
TIME_TK,
FREQ_TK,
DIMEN_TK,
PERCENTAGE_TK,
NUMBER_TK,
RGB_TK,
URI_TK,
FUNCTION_TK,
UNICODERANGE_TK,
SEMICOLON_TK,
CBO_TK, /*opening curly bracket*/
CBC_TK, /*closing curly bracket*/
PO_TK, /*opening parenthesis*/
PC_TK, /*closing parenthesis*/
BO_TK, /*opening bracket*/
BC_TK, /*closing bracket*/
DELIM_TK
} ;
enum CRTokenExtraType
{
NO_ET = 0,
LENGTH_PX_ET,
LENGTH_CM_ET,
LENGTH_MM_ET,
LENGTH_IN_ET,
LENGTH_PT_ET,
LENGTH_PC_ET,
ANGLE_DEG_ET,
ANGLE_RAD_ET,
ANGLE_GRAD_ET,
TIME_MS_ET,
TIME_S_ET,
FREQ_HZ_ET,
FREQ_KHZ_ET
} ;
typedef struct _CRToken CRToken ;
/**
*This class abstracts a css2 token.
*/
struct _CRToken
{
enum CRTokenType type ;
enum CRTokenExtraType extra_type ;
CRInputPos pos ;
union
{
CRString *str ;
CRRgb *rgb ;
CRNum *num ;
guint32 unichar ;
} u ;
CRString * dimen ;
CRParsingLocation location ;
} ;
CRToken* cr_token_new (void) ;
enum CRStatus cr_token_set_s (CRToken *a_this) ;
enum CRStatus cr_token_set_cdo (CRToken *a_this) ;
enum CRStatus cr_token_set_cdc (CRToken *a_this) ;
enum CRStatus cr_token_set_includes (CRToken *a_this) ;
enum CRStatus cr_token_set_dashmatch (CRToken *a_this) ;
enum CRStatus cr_token_set_comment (CRToken *a_this, CRString *a_str) ;
enum CRStatus cr_token_set_string (CRToken *a_this, CRString *a_str) ;
enum CRStatus cr_token_set_ident (CRToken *a_this, CRString * a_ident) ;
enum CRStatus cr_token_set_hash (CRToken *a_this, CRString *a_hash) ;
enum CRStatus cr_token_set_rgb (CRToken *a_this, CRRgb *a_rgb) ;
enum CRStatus cr_token_set_import_sym (CRToken *a_this) ;
enum CRStatus cr_token_set_page_sym (CRToken *a_this) ;
enum CRStatus cr_token_set_media_sym (CRToken *a_this) ;
enum CRStatus cr_token_set_font_face_sym (CRToken *a_this) ;
enum CRStatus cr_token_set_charset_sym (CRToken *a_this) ;
enum CRStatus cr_token_set_atkeyword (CRToken *a_this, CRString *a_atname) ;
enum CRStatus cr_token_set_important_sym (CRToken *a_this) ;
enum CRStatus cr_token_set_ems (CRToken *a_this, CRNum *a_num) ;
enum CRStatus cr_token_set_exs (CRToken *a_this, CRNum *a_num) ;
enum CRStatus cr_token_set_length (CRToken *a_this, CRNum *a_num,
enum CRTokenExtraType a_et) ;
enum CRStatus cr_token_set_angle (CRToken *a_this, CRNum *a_num,
enum CRTokenExtraType a_et) ;
enum CRStatus cr_token_set_time (CRToken *a_this, CRNum *a_num,
enum CRTokenExtraType a_et) ;
enum CRStatus cr_token_set_freq (CRToken *a_this, CRNum *a_num,
enum CRTokenExtraType a_et) ;
enum CRStatus cr_token_set_dimen (CRToken *a_this, CRNum *a_num,
CRString *a_dim) ;
enum CRStatus cr_token_set_percentage (CRToken *a_this, CRNum *a_num) ;
enum CRStatus cr_token_set_number (CRToken *a_this, CRNum *a_num) ;
enum CRStatus cr_token_set_uri (CRToken *a_this, CRString *a_uri) ;
enum CRStatus cr_token_set_function (CRToken *a_this,
CRString *a_fun_name) ;
enum CRStatus cr_token_set_bc (CRToken *a_this) ;
enum CRStatus cr_token_set_bo (CRToken *a_this) ;
enum CRStatus cr_token_set_po (CRToken *a_this) ;
enum CRStatus cr_token_set_pc (CRToken *a_this) ;
enum CRStatus cr_token_set_cbc (CRToken *a_this) ;
enum CRStatus cr_token_set_cbo (CRToken *a_this) ;
enum CRStatus cr_token_set_semicolon (CRToken *a_this) ;
enum CRStatus cr_token_set_delim (CRToken *a_this, guint32 a_char) ;
/*
enum CRStatus
cr_token_set_unicoderange (CRToken *a_this,
CRUnicodeRange *a_range) ;
*/
void
cr_token_destroy (CRToken *a_this) ;
G_END_DECLS
#endif /*__CR_TOKEN_H__*/

246
node_modules/sharp/vendor/include/libcroco/cr-utils.h generated vendored Normal file
View File

@ -0,0 +1,246 @@
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Author: Dodji Seketeli
* Look at file COPYRIGHTS for copyright information
*/
#ifndef __CR_DEFS_H__
#define __CR_DEFS_H__
#include <stdio.h>
#include <glib.h>
#include "libcroco-config.h"
G_BEGIN_DECLS
/**
*@file
*The Croco library basic types definitions
*And global definitions.
*/
/**
*The status type returned
*by the methods of the croco library.
*/
enum CRStatus {
CR_OK,
CR_BAD_PARAM_ERROR,
CR_INSTANCIATION_FAILED_ERROR,
CR_UNKNOWN_TYPE_ERROR,
CR_UNKNOWN_PROP_ERROR,
CR_UNKNOWN_PROP_VAL_ERROR,
CR_UNEXPECTED_POSITION_SCHEME,
CR_START_OF_INPUT_ERROR,
CR_END_OF_INPUT_ERROR,
CR_OUTPUT_TOO_SHORT_ERROR,
CR_INPUT_TOO_SHORT_ERROR,
CR_OUT_OF_BOUNDS_ERROR,
CR_EMPTY_PARSER_INPUT_ERROR,
CR_ENCODING_ERROR,
CR_ENCODING_NOT_FOUND_ERROR,
CR_PARSING_ERROR,
CR_SYNTAX_ERROR,
CR_NO_ROOT_NODE_ERROR,
CR_NO_TOKEN,
CR_OUT_OF_MEMORY_ERROR,
CR_PSEUDO_CLASS_SEL_HANDLER_NOT_FOUND_ERROR,
CR_BAD_PSEUDO_CLASS_SEL_HANDLER_ERROR,
CR_ERROR,
CR_FILE_NOT_FOUND_ERROR,
CR_VALUE_NOT_FOUND_ERROR
} ;
/**
*Values used by
*cr_input_seek_position() ;
*/
enum CRSeekPos {
CR_SEEK_CUR,
CR_SEEK_BEGIN,
CR_SEEK_END
} ;
/**
*Encoding values.
*/
enum CREncoding
{
CR_UCS_4 = 1/*Must be not NULL*/,
CR_UCS_1,
CR_ISO_8859_1,
CR_ASCII,
CR_UTF_8,
CR_UTF_16,
CR_AUTO/*should be the last one*/
} ;
#define CROCO_LOG_DOMAIN "LIBCROCO"
#ifdef __GNUC__
#define cr_utils_trace(a_log_level, a_msg) \
g_log (CROCO_LOG_DOMAIN, \
G_LOG_LEVEL_CRITICAL, \
"file %s: line %d (%s): %s\n", \
__FILE__, \
__LINE__, \
__PRETTY_FUNCTION__, \
a_msg)
#else /*__GNUC__*/
#define cr_utils_trace(a_log_level, a_msg) \
g_log (CROCO_LOG_DOMAIN, \
G_LOG_LEVEL_CRITICAL, \
"file %s: line %d: %s\n", \
__FILE__, \
__LINE__, \
a_msg)
#endif
/**
*Traces an info message.
*The file, line and enclosing function
*of the message will be automatically
*added to the message.
*@param a_msg the msg to trace.
*/
#define cr_utils_trace_info(a_msg) \
cr_utils_trace (G_LOG_LEVEL_INFO, a_msg)
/**
*Trace a debug message.
*The file, line and enclosing function
*of the message will be automatically
*added to the message.
*@param a_msg the msg to trace.
*/
#define cr_utils_trace_debug(a_msg) \
cr_utils_trace (G_LOG_LEVEL_DEBUG, a_msg) ;
/****************************
*Encoding transformations and
*encoding helpers
****************************/
enum CRStatus
cr_utils_read_char_from_utf8_buf (const guchar * a_in, gulong a_in_len,
guint32 *a_out, gulong *a_consumed) ;
enum CRStatus
cr_utils_ucs1_to_utf8 (const guchar *a_in, gulong *a_in_len,
guchar *a_out, gulong *a_out_len) ;
enum CRStatus
cr_utils_utf8_to_ucs1 (const guchar * a_in, gulong * a_in_len,
guchar *a_out, gulong *a_out_len) ;
enum CRStatus
cr_utils_ucs4_to_utf8 (const guint32 *a_in, gulong *a_in_len,
guchar *a_out, gulong *a_out_len) ;
enum CRStatus
cr_utils_utf8_str_len_as_ucs4 (const guchar *a_in_start,
const guchar *a_in_end,
gulong *a_len) ;
enum CRStatus
cr_utils_ucs1_str_len_as_utf8 (const guchar *a_in_start,
const guchar *a_in_end,
gulong *a_len) ;
enum CRStatus
cr_utils_utf8_str_len_as_ucs1 (const guchar *a_in_start,
const guchar *a_in_end,
gulong *a_len) ;
enum CRStatus
cr_utils_ucs4_str_len_as_utf8 (const guint32 *a_in_start,
const guint32 *a_in_end,
gulong *a_len) ;
enum CRStatus
cr_utils_ucs1_str_to_utf8 (const guchar *a_in_start,
gulong *a_in_len,
guchar **a_out,
gulong *a_len) ;
enum CRStatus
cr_utils_utf8_str_to_ucs1 (const guchar * a_in_start,
gulong * a_in_len,
guchar **a_out,
gulong *a_out_len) ;
enum CRStatus
cr_utils_utf8_to_ucs4 (const guchar * a_in,
gulong * a_in_len,
guint32 *a_out, gulong *a_out_len) ;
enum CRStatus
cr_utils_ucs4_str_to_utf8 (const guint32 *a_in,
gulong *a_in_len,
guchar **a_out, gulong *a_out_len) ;
enum CRStatus
cr_utils_utf8_str_to_ucs4 (const guchar * a_in,
gulong *a_in_len,
guint32 **a_out,
gulong *a_out_len) ;
/*****************************************
*CSS basic types identification utilities
*****************************************/
gboolean
cr_utils_is_newline (guint32 a_char) ;
gboolean
cr_utils_is_white_space (guint32 a_char) ;
gboolean
cr_utils_is_nonascii (guint32 a_char) ;
gboolean
cr_utils_is_hexa_char (guint32 a_char) ;
/**********************************
*Miscellaneous utility functions
***********************************/
void
cr_utils_dump_n_chars (guchar a_char,
FILE *a_fp,
glong a_nb) ;
void
cr_utils_dump_n_chars2 (guchar a_char,
GString *a_string,
glong a_nb) ;
GList *
cr_utils_dup_glist_of_string (GList const *a_list) ;
GList *
cr_utils_dup_glist_of_cr_string (GList const * a_list_of_strings) ;
G_END_DECLS
#endif /*__CR_DEFS_H__*/

View File

@ -0,0 +1,17 @@
#ifndef LIBCROCO_VERSION_NUMBER
#define LIBCROCO_VERSION_NUMBER 612
#endif
#ifndef LIBCROCO_VERSION
#define LIBCROCO_VERSION "0.6.12"
#endif
#ifndef G_DISABLE_CHECKS
#if 0
#define G_DISABLE_CHECKS 0
#endif
#endif
#ifndef CROCO_HAVE_LIBXML2
#define CROCO_HAVE_LIBXML2 (1)
#endif

44
node_modules/sharp/vendor/include/libcroco/libcroco.h generated vendored Normal file
View File

@ -0,0 +1,44 @@
/*
* This file is part of The Croco Library
*
* Copyright (C) 2002-2003 Dodji Seketeli <dodji@seketeli.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
#ifndef __LIBCROCO_H__
#define __LIBCROCO_H__
#include "libcroco-config.h"
#include "cr-utils.h"
#include "cr-pseudo.h"
#include "cr-term.h"
#include "cr-attr-sel.h"
#include "cr-simple-sel.h"
#include "cr-selector.h"
#include "cr-enc-handler.h"
#include "cr-doc-handler.h"
#include "cr-input.h"
#include "cr-parser.h"
#include "cr-statement.h"
#include "cr-stylesheet.h"
#include "cr-om-parser.h"
#include "cr-prop-list.h"
#include "cr-sel-eng.h"
#include "cr-style.h"
#include "cr-string.h"
#endif /*__LIBCROCO_H__*/