epoc32/include/stdapis/glib-2.0/glib/gscanner.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/stdapis/glib-2.0/glib/gscanner.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/stdapis/glib-2.0/glib/gscanner.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,277 @@
     1.4 -gscanner.h
     1.5 +/* GLIB - Library of useful routines for C programming
     1.6 + * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
     1.7 + * Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
     1.8 + *
     1.9 + * This library is free software; you can redistribute it and/or
    1.10 + * modify it under the terms of the GNU Lesser General Public
    1.11 + * License as published by the Free Software Foundation; either
    1.12 + * version 2 of the License, or (at your option) any later version.
    1.13 + *
    1.14 + * This library is distributed in the hope that it will be useful,
    1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
    1.17 + * Lesser General Public License for more details.
    1.18 + *
    1.19 + * You should have received a copy of the GNU Lesser General Public
    1.20 + * License along with this library; if not, write to the
    1.21 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    1.22 + * Boston, MA 02111-1307, USA.
    1.23 + */
    1.24 +
    1.25 +/*
    1.26 + * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
    1.27 + * file for a list of people on the GLib Team.  See the ChangeLog
    1.28 + * files for a list of changes.  These files are distributed with
    1.29 + * GLib at ftp://ftp.gtk.org/pub/gtk/. 
    1.30 + */
    1.31 +
    1.32 +#ifndef __G_SCANNER_H__
    1.33 +#define __G_SCANNER_H__
    1.34 +
    1.35 +#include <_ansi.h>
    1.36 +#include <glib/gdataset.h>
    1.37 +#include <glib/ghash.h>
    1.38 +
    1.39 +G_BEGIN_DECLS
    1.40 +
    1.41 +typedef struct _GScanner	GScanner;
    1.42 +typedef struct _GScannerConfig	GScannerConfig;
    1.43 +typedef union  _GTokenValue     GTokenValue;
    1.44 +
    1.45 +typedef void		(*GScannerMsgFunc)	(GScanner      *scanner,
    1.46 +						 gchar	       *message,
    1.47 +						 gboolean	error);
    1.48 +
    1.49 +/* GScanner: Flexible lexical scanner for general purpose.
    1.50 + */
    1.51 +
    1.52 +/* Character sets */
    1.53 +#define G_CSET_A_2_Z	"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    1.54 +#define G_CSET_a_2_z	"abcdefghijklmnopqrstuvwxyz"
    1.55 +#define G_CSET_DIGITS	"0123456789"
    1.56 +#define G_CSET_LATINC	"\300\301\302\303\304\305\306"\
    1.57 +			"\307\310\311\312\313\314\315\316\317\320"\
    1.58 +			"\321\322\323\324\325\326"\
    1.59 +			"\330\331\332\333\334\335\336"
    1.60 +#define G_CSET_LATINS	"\337\340\341\342\343\344\345\346"\
    1.61 +			"\347\350\351\352\353\354\355\356\357\360"\
    1.62 +			"\361\362\363\364\365\366"\
    1.63 +			"\370\371\372\373\374\375\376\377"
    1.64 +
    1.65 +/* Error types */
    1.66 +typedef enum
    1.67 +{
    1.68 +  G_ERR_UNKNOWN,
    1.69 +  G_ERR_UNEXP_EOF,
    1.70 +  G_ERR_UNEXP_EOF_IN_STRING,
    1.71 +  G_ERR_UNEXP_EOF_IN_COMMENT,
    1.72 +  G_ERR_NON_DIGIT_IN_CONST,
    1.73 +  G_ERR_DIGIT_RADIX,
    1.74 +  G_ERR_FLOAT_RADIX,
    1.75 +  G_ERR_FLOAT_MALFORMED
    1.76 +} GErrorType;
    1.77 +
    1.78 +/* Token types */
    1.79 +typedef enum
    1.80 +{
    1.81 +  G_TOKEN_EOF			=   0,
    1.82 +  
    1.83 +  G_TOKEN_LEFT_PAREN		= '(',
    1.84 +  G_TOKEN_RIGHT_PAREN		= ')',
    1.85 +  G_TOKEN_LEFT_CURLY		= '{',
    1.86 +  G_TOKEN_RIGHT_CURLY		= '}',
    1.87 +  G_TOKEN_LEFT_BRACE		= '[',
    1.88 +  G_TOKEN_RIGHT_BRACE		= ']',
    1.89 +  G_TOKEN_EQUAL_SIGN		= '=',
    1.90 +  G_TOKEN_COMMA			= ',',
    1.91 +  
    1.92 +  G_TOKEN_NONE			= 256,
    1.93 +  
    1.94 +  G_TOKEN_ERROR,
    1.95 +  
    1.96 +  G_TOKEN_CHAR,
    1.97 +  G_TOKEN_BINARY,
    1.98 +  G_TOKEN_OCTAL,
    1.99 +  G_TOKEN_INT,
   1.100 +  G_TOKEN_HEX,
   1.101 +  G_TOKEN_FLOAT,
   1.102 +  G_TOKEN_STRING,
   1.103 +  
   1.104 +  G_TOKEN_SYMBOL,
   1.105 +  G_TOKEN_IDENTIFIER,
   1.106 +  G_TOKEN_IDENTIFIER_NULL,
   1.107 +  
   1.108 +  G_TOKEN_COMMENT_SINGLE,
   1.109 +  G_TOKEN_COMMENT_MULTI,
   1.110 +  G_TOKEN_LAST
   1.111 +} GTokenType;
   1.112 +
   1.113 +union	_GTokenValue
   1.114 +{
   1.115 +  gpointer	v_symbol;
   1.116 +  gchar		*v_identifier;
   1.117 +  gulong	v_binary;
   1.118 +  gulong	v_octal;
   1.119 +  gulong	v_int;
   1.120 +  guint64       v_int64;
   1.121 +  gdouble	v_float;
   1.122 +  gulong	v_hex;
   1.123 +  gchar		*v_string;
   1.124 +  gchar		*v_comment;
   1.125 +  guchar	v_char;
   1.126 +  guint		v_error;
   1.127 +};
   1.128 +
   1.129 +struct	_GScannerConfig
   1.130 +{
   1.131 +  /* Character sets
   1.132 +   */
   1.133 +  gchar		*cset_skip_characters;		/* default: " \t\n" */
   1.134 +  gchar		*cset_identifier_first;
   1.135 +  gchar		*cset_identifier_nth;
   1.136 +  gchar		*cpair_comment_single;		/* default: "#\n" */
   1.137 +  
   1.138 +  /* Should symbol lookup work case sensitive?
   1.139 +   */
   1.140 +  guint		case_sensitive : 1;
   1.141 +  
   1.142 +  /* Boolean values to be adjusted "on the fly"
   1.143 +   * to configure scanning behaviour.
   1.144 +   */
   1.145 +  guint		skip_comment_multi : 1;		/* C like comment */
   1.146 +  guint		skip_comment_single : 1;	/* single line comment */
   1.147 +  guint		scan_comment_multi : 1;		/* scan multi line comments? */
   1.148 +  guint		scan_identifier : 1;
   1.149 +  guint		scan_identifier_1char : 1;
   1.150 +  guint		scan_identifier_NULL : 1;
   1.151 +  guint		scan_symbols : 1;
   1.152 +  guint		scan_binary : 1;
   1.153 +  guint		scan_octal : 1;
   1.154 +  guint		scan_float : 1;
   1.155 +  guint		scan_hex : 1;			/* `0x0ff0' */
   1.156 +  guint		scan_hex_dollar : 1;		/* `$0ff0' */
   1.157 +  guint		scan_string_sq : 1;		/* string: 'anything' */
   1.158 +  guint		scan_string_dq : 1;		/* string: "\\-escapes!\n" */
   1.159 +  guint		numbers_2_int : 1;		/* bin, octal, hex => int */
   1.160 +  guint		int_2_float : 1;		/* int => G_TOKEN_FLOAT? */
   1.161 +  guint		identifier_2_string : 1;
   1.162 +  guint		char_2_token : 1;		/* return G_TOKEN_CHAR? */
   1.163 +  guint		symbol_2_token : 1;
   1.164 +  guint		scope_0_fallback : 1;		/* try scope 0 on lookups? */
   1.165 +  guint		store_int64 : 1; 		/* use value.v_int64 rather than v_int */
   1.166 +  guint		padding_dummy;
   1.167 +};
   1.168 +
   1.169 +struct	_GScanner
   1.170 +{
   1.171 +  /* unused fields */
   1.172 +  gpointer		user_data;
   1.173 +  guint			max_parse_errors;
   1.174 +  
   1.175 +  /* g_scanner_error() increments this field */
   1.176 +  guint			parse_errors;
   1.177 +  
   1.178 +  /* name of input stream, featured by the default message handler */
   1.179 +  const gchar		*input_name;
   1.180 +  
   1.181 +  /* quarked data */
   1.182 +  GData			*qdata;
   1.183 +  
   1.184 +  /* link into the scanner configuration */
   1.185 +  GScannerConfig	*config;
   1.186 +  
   1.187 +  /* fields filled in after g_scanner_get_next_token() */
   1.188 +  GTokenType		token;
   1.189 +  GTokenValue		value;
   1.190 +  guint			line;
   1.191 +  guint			position;
   1.192 +  
   1.193 +  /* fields filled in after g_scanner_peek_next_token() */
   1.194 +  GTokenType		next_token;
   1.195 +  GTokenValue		next_value;
   1.196 +  guint			next_line;
   1.197 +  guint			next_position;
   1.198 +  
   1.199 +  /* to be considered private */
   1.200 +  GHashTable		*symbol_table;
   1.201 +  gint			input_fd;
   1.202 +  const gchar		*text;
   1.203 +  const gchar		*text_end;
   1.204 +  gchar			*buffer;
   1.205 +  guint			scope_id;
   1.206 +  
   1.207 +  /* handler function for _warn and _error */
   1.208 +  GScannerMsgFunc	msg_handler;
   1.209 +};
   1.210 +
   1.211 +IMPORT_C GScanner*	g_scanner_new			(const GScannerConfig *config_templ);
   1.212 +IMPORT_C void		g_scanner_destroy		(GScanner	*scanner);
   1.213 +IMPORT_C void		g_scanner_input_file		(GScanner	*scanner,
   1.214 +						 gint		input_fd);
   1.215 +IMPORT_C void		g_scanner_sync_file_offset	(GScanner	*scanner);
   1.216 +IMPORT_C void		g_scanner_input_text		(GScanner	*scanner,
   1.217 +						 const	gchar	*text,
   1.218 +						 guint		text_len);
   1.219 +IMPORT_C GTokenType	g_scanner_get_next_token	(GScanner	*scanner);
   1.220 +IMPORT_C GTokenType	g_scanner_peek_next_token	(GScanner	*scanner);
   1.221 +IMPORT_C GTokenType	g_scanner_cur_token		(GScanner	*scanner);
   1.222 +IMPORT_C GTokenValue	g_scanner_cur_value		(GScanner	*scanner);
   1.223 +IMPORT_C guint		g_scanner_cur_line		(GScanner	*scanner);
   1.224 +IMPORT_C guint		g_scanner_cur_position		(GScanner	*scanner);
   1.225 +IMPORT_C gboolean	g_scanner_eof			(GScanner	*scanner);
   1.226 +IMPORT_C guint		g_scanner_set_scope		(GScanner	*scanner,
   1.227 +						 guint		 scope_id);
   1.228 +IMPORT_C void		g_scanner_scope_add_symbol	(GScanner	*scanner,
   1.229 +						 guint		 scope_id,
   1.230 +						 const gchar	*symbol,
   1.231 +						 gpointer	value);
   1.232 +IMPORT_C void		g_scanner_scope_remove_symbol	(GScanner	*scanner,
   1.233 +						 guint		 scope_id,
   1.234 +						 const gchar	*symbol);
   1.235 +IMPORT_C gpointer	g_scanner_scope_lookup_symbol	(GScanner	*scanner,
   1.236 +						 guint		 scope_id,
   1.237 +						 const gchar	*symbol);
   1.238 +IMPORT_C void		g_scanner_scope_foreach_symbol	(GScanner	*scanner,
   1.239 +						 guint		 scope_id,
   1.240 +						 GHFunc		 func,
   1.241 +						 gpointer	 user_data);
   1.242 +IMPORT_C gpointer	g_scanner_lookup_symbol		(GScanner	*scanner,
   1.243 +						 const gchar	*symbol);
   1.244 +IMPORT_C void		g_scanner_unexp_token		(GScanner	*scanner,
   1.245 +						 GTokenType	expected_token,
   1.246 +						 const gchar	*identifier_spec,
   1.247 +						 const gchar	*symbol_spec,
   1.248 +						 const gchar	*symbol_name,
   1.249 +						 const gchar	*message,
   1.250 +						 gint		 is_error);
   1.251 +IMPORT_C void		g_scanner_error			(GScanner	*scanner,
   1.252 +						 const gchar	*format,
   1.253 +						 ...) G_GNUC_PRINTF (2,3);
   1.254 +IMPORT_C void		g_scanner_warn			(GScanner	*scanner,
   1.255 +						 const gchar	*format,
   1.256 +						 ...) G_GNUC_PRINTF (2,3);
   1.257 +
   1.258 +#ifndef G_DISABLE_DEPRECATED
   1.259 +
   1.260 +/* keep downward source compatibility */
   1.261 +#define		g_scanner_add_symbol( scanner, symbol, value )	G_STMT_START { \
   1.262 +  g_scanner_scope_add_symbol ((scanner), 0, (symbol), (value)); \
   1.263 +} G_STMT_END
   1.264 +#define		g_scanner_remove_symbol( scanner, symbol )	G_STMT_START { \
   1.265 +  g_scanner_scope_remove_symbol ((scanner), 0, (symbol)); \
   1.266 +} G_STMT_END
   1.267 +#define		g_scanner_foreach_symbol( scanner, func, data )	G_STMT_START { \
   1.268 +  g_scanner_scope_foreach_symbol ((scanner), 0, (func), (data)); \
   1.269 +} G_STMT_END
   1.270 +
   1.271 +/* The following two functions are deprecated and will be removed in
   1.272 + * the next major release. They do no good. */
   1.273 +#define g_scanner_freeze_symbol_table(scanner) ((void)0)
   1.274 +#define g_scanner_thaw_symbol_table(scanner) ((void)0)
   1.275 +
   1.276 +#endif /* G_DISABLE_DEPRECATED */
   1.277 +
   1.278 +G_END_DECLS
   1.279 +
   1.280 +#endif /* __G_SCANNER_H__ */
   1.281 +