Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
cr-utils.h
Go to the documentation of this file.
1/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
2
3/*
4 * This file is part of The Croco Library
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2.1 of the GNU Lesser General Public
8 * License as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18 * USA
19 *
20 * Author: Dodji Seketeli
21 * Look at file COPYRIGHTS for copyright information
22 */
23
24#ifndef __CR_DEFS_H__
25#define __CR_DEFS_H__
26
27#include <stdio.h>
28#include <glib.h>
29
30G_BEGIN_DECLS
31
69
79
84{
85 CR_UCS_4 = 1/*Must be not NULL*/,
91 CR_AUTO/*should be the last one*/
92} ;
93
94
95
96
97#define CROCO_LOG_DOMAIN "LIBCROCO"
98
99#ifdef __GNUC__
100#define cr_utils_trace(a_log_level, a_msg) \
101g_log (CROCO_LOG_DOMAIN, \
102 G_LOG_LEVEL_CRITICAL, \
103 "file %s: line %d (%s): %s\n", \
104 __FILE__, \
105 __LINE__, \
106 __PRETTY_FUNCTION__, \
107 a_msg)
108#else /*__GNUC__*/
109
110#define cr_utils_trace(a_log_level, a_msg) \
111g_log (CROCO_LOG_DOMAIN, \
112 G_LOG_LEVEL_CRITICAL, \
113 "file %s: line %d: %s\n", \
114 __FILE__, \
115 __LINE__, \
116 a_msg)
117#endif
118
126#define cr_utils_trace_info(a_msg) \
127cr_utils_trace (G_LOG_LEVEL_INFO, a_msg)
128
136#define cr_utils_trace_debug(a_msg) \
137cr_utils_trace (G_LOG_LEVEL_DEBUG, a_msg) ;
138
139
140/****************************
141 *Encoding transformations and
142 *encoding helpers
143 ****************************/
144
145enum CRStatus
146cr_utils_read_char_from_utf8_buf (const guchar * a_in, gulong a_in_len,
147 guint32 *a_out, gulong *a_consumed) ;
148
149enum CRStatus
150cr_utils_ucs1_to_utf8 (const guchar *a_in, gulong *a_in_len,
151 guchar *a_out, gulong *a_out_len) ;
152
153enum CRStatus
154cr_utils_utf8_to_ucs1 (const guchar * a_in, gulong * a_in_len,
155 guchar *a_out, gulong *a_out_len) ;
156
157enum CRStatus
158cr_utils_ucs4_to_utf8 (const guint32 *a_in, gulong *a_in_len,
159 guchar *a_out, gulong *a_out_len) ;
160
161enum CRStatus
162cr_utils_utf8_str_len_as_ucs4 (const guchar *a_in_start,
163 const guchar *a_in_end,
164 gulong *a_len) ;
165enum CRStatus
166cr_utils_ucs1_str_len_as_utf8 (const guchar *a_in_start,
167 const guchar *a_in_end,
168 gulong *a_len) ;
169enum CRStatus
170cr_utils_utf8_str_len_as_ucs1 (const guchar *a_in_start,
171 const guchar *a_in_end,
172 gulong *a_len) ;
173enum CRStatus
175 const guint32 *a_in_end,
176 gulong *a_len) ;
177
178enum CRStatus
179cr_utils_ucs1_str_to_utf8 (const guchar *a_in_start,
180 gulong *a_in_len,
181 guchar **a_out,
182 gulong *a_len) ;
183
184enum CRStatus
185cr_utils_utf8_str_to_ucs1 (const guchar * a_in_start,
186 gulong * a_in_len,
187 guchar **a_out,
188 gulong *a_out_len) ;
189
190enum CRStatus
191cr_utils_utf8_to_ucs4 (const guchar * a_in,
192 gulong * a_in_len,
193 guint32 *a_out, gulong *a_out_len) ;
194
195enum CRStatus
197 gulong *a_in_len,
198 guchar **a_out, gulong *a_out_len) ;
199
200enum CRStatus
201cr_utils_utf8_str_to_ucs4 (const guchar * a_in,
202 gulong *a_in_len,
203 guint32 **a_out,
204 gulong *a_out_len) ;
205
206
207/*****************************************
208 *CSS basic types identification utilities
209 *****************************************/
210
211gboolean
213
214gboolean
216
217gboolean
219
220gboolean
222
223
224/**********************************
225 *Miscellaneous utility functions
226 ***********************************/
227
228void
229cr_utils_dump_n_chars (guchar a_char,
230 FILE *a_fp,
231 glong a_nb) ;
232
233void
235 GString *a_string,
236 glong a_nb) ;
237GList *
238cr_utils_dup_glist_of_string (GList const *a_list) ;
239
240GList *
241cr_utils_dup_glist_of_cr_string (GList const * a_list_of_strings) ;
242
243G_END_DECLS
244
245#endif /*__CR_DEFS_H__*/
GList * cr_utils_dup_glist_of_cr_string(GList const *a_list_of_strings)
enum CRStatus cr_utils_ucs1_str_len_as_utf8(const guchar *a_in_start, const guchar *a_in_end, gulong *a_len)
gboolean cr_utils_is_nonascii(guint32 a_char)
CRStatus
The status type returned by the methods of the croco library.
Definition cr-utils.h:42
@ CR_NO_ROOT_NODE_ERROR
Definition cr-utils.h:60
@ CR_PSEUDO_CLASS_SEL_HANDLER_NOT_FOUND_ERROR
Definition cr-utils.h:63
@ CR_OUTPUT_TOO_SHORT_ERROR
Definition cr-utils.h:52
@ CR_BAD_PARAM_ERROR
Definition cr-utils.h:44
@ CR_NO_TOKEN
Definition cr-utils.h:61
@ CR_INPUT_TOO_SHORT_ERROR
Definition cr-utils.h:53
@ CR_OUT_OF_MEMORY_ERROR
Definition cr-utils.h:62
@ CR_OK
Definition cr-utils.h:43
@ CR_END_OF_INPUT_ERROR
Definition cr-utils.h:51
@ CR_UNKNOWN_PROP_VAL_ERROR
Definition cr-utils.h:48
@ CR_UNEXPECTED_POSITION_SCHEME
Definition cr-utils.h:49
@ CR_PARSING_ERROR
Definition cr-utils.h:58
@ CR_INSTANCIATION_FAILED_ERROR
Definition cr-utils.h:45
@ CR_ERROR
Definition cr-utils.h:65
@ CR_OUT_OF_BOUNDS_ERROR
Definition cr-utils.h:54
@ CR_UNKNOWN_TYPE_ERROR
Definition cr-utils.h:46
@ CR_ENCODING_ERROR
Definition cr-utils.h:56
@ CR_BAD_PSEUDO_CLASS_SEL_HANDLER_ERROR
Definition cr-utils.h:64
@ CR_SYNTAX_ERROR
Definition cr-utils.h:59
@ CR_VALUE_NOT_FOUND_ERROR
Definition cr-utils.h:67
@ CR_ENCODING_NOT_FOUND_ERROR
Definition cr-utils.h:57
@ CR_FILE_NOT_FOUND_ERROR
Definition cr-utils.h:66
@ CR_UNKNOWN_PROP_ERROR
Definition cr-utils.h:47
@ CR_START_OF_INPUT_ERROR
Definition cr-utils.h:50
@ CR_EMPTY_PARSER_INPUT_ERROR
Definition cr-utils.h:55
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_str_to_ucs4(const guchar *a_in, gulong *a_in_len, guint32 **a_out, gulong *a_out_len)
gboolean cr_utils_is_hexa_char(guint32 a_char)
gboolean cr_utils_is_newline(guint32 a_char)
void cr_utils_dump_n_chars2(guchar a_char, GString *a_string, glong a_nb)
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_to_ucs1(const guchar *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_ucs4_str_len_as_utf8(const guint32 *a_in_start, const guint32 *a_in_end, gulong *a_len)
gboolean cr_utils_is_white_space(guint32 a_char)
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_ucs1(const guchar *a_in_start, const guchar *a_in_end, gulong *a_len)
enum CRStatus cr_utils_ucs4_str_to_utf8(const guint32 *a_in, gulong *a_in_len, guchar **a_out, gulong *a_out_len)
void cr_utils_dump_n_chars(guchar a_char, FILE *a_fp, glong a_nb)
CRSeekPos
Values used by cr_input_seek_position() ;.
Definition cr-utils.h:74
@ CR_SEEK_CUR
Definition cr-utils.h:75
@ CR_SEEK_BEGIN
Definition cr-utils.h:76
@ CR_SEEK_END
Definition cr-utils.h:77
enum CRStatus cr_utils_read_char_from_utf8_buf(const guchar *a_in, gulong a_in_len, guint32 *a_out, gulong *a_consumed)
GList * cr_utils_dup_glist_of_string(GList const *a_list)
CREncoding
Encoding values.
Definition cr-utils.h:84
@ CR_UCS_1
Definition cr-utils.h:86
@ CR_UTF_8
Definition cr-utils.h:89
@ CR_AUTO
Definition cr-utils.h:91
@ CR_ASCII
Definition cr-utils.h:88
@ CR_ISO_8859_1
Definition cr-utils.h:87
@ CR_UTF_16
Definition cr-utils.h:90
@ CR_UCS_4
Definition cr-utils.h:85
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)
unsigned int guint32