summaryrefslogtreecommitdiff
path: root/src/parser/cr-parser-input.h
blob: 97ca5d5bcef61a4dbd05f6f43c89140cfe672ebd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/* -*- Mode: C; indent-tabs-mode: ni; 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
 */

#ifndef __CR_PARSER_INPUT_H__
#define __CR_PARSER_INPUT_H__

#include "cr-input.h"

#ifdef __cplusplus
extern "C" {
#endif 

	typedef struct _CRParserInput CRParserInput ;
	typedef struct _CRParserInputPriv CRParserInputPriv ;

	struct _CRParserInput 
	{
		CRParserInputPriv *priv ;
	} ;

	typedef struct _CRParserInputPos CRParserInputPos ;
	
	struct _CRParserInputPos
	{
		CRInputPos input_pos ;

		/*not used yet*/
		glong stack_size ;
	} ;

	CRParserInput *
	cr_parser_input_new_from_uri (gchar *a_uri, enum CREncoding) ;
	
	void
	cr_parser_input_ref (CRParserInput *a_this) ;

	gboolean
	cr_parser_input_unref (CRParserInput *a_this) ;

	void
	cr_parser_input_destroy (CRParserInput *a_this) ;

	enum CRStatus
	cr_parser_input_push_input (CRParserInput *a_this, 
				    CRInput *a_input) ;

	enum CRStatus
	cr_parser_input_pop_input (CRParserInput *a_this) ;

	CRInput *
	cr_parser_input_peek_input (CRParserInput *a_this) ;

	enum CRStatus
	cr_parser_input_get_byte_addr (CRParserInput *a_this,
				       gulong a_offset,
				       guchar **a_addr) ;

	enum CRStatus
	cr_parser_input_get_cur_byte_addr (CRParserInput *a_this, 
					   guchar **a_addr) ;
	enum CRStatus
	cr_parser_input_read_byte (CRParserInput *a_this, 
				   guchar * a_byte) ;

	enum CRStatus
	cr_parser_input_read_char (CRParserInput *a_this, 
				   guint32 * a_byte) ;

	enum CRStatus
        cr_parser_input_get_end_of_file (CRParserInput *a_this, 
					 gboolean *a_eof) ;

	enum CRStatus
	cr_parser_input_consume_char (CRParserInput *a_this, 
				      guint32 a_char) ;

	enum CRStatus
	cr_parser_input_consume_chars (CRParserInput *a_this, 
				       guint32 a_char,
				       glong *a_nb_char) ;

	enum CRStatus
	cr_parser_input_consume_spaces (CRParserInput *a_this, 
					glong *a_nb_char) ;

	enum CRStatus
	cr_parser_input_peek_byte (CRParserInput *a_this,
				   enum CRSeekPos a_origin,
				   gulong a_offset, guchar *a_byte) ;

	enum CRStatus
	cr_parser_input_peek_char (CRParserInput *a_this,
				   guint32 *a_char) ;

	glong
	cr_parser_input_get_nb_bytes_left (CRParserInput *a_this) ;

	enum CRStatus
	cr_parser_input_seek_index (CRParserInput *a_this,
				    enum CRSeekPos a_origin,
				    gint a_pos) ;

	enum CRStatus
	cr_parser_input_get_cur_pos (CRParserInput *a_this,
				     CRParserInputPos *a_pos) ;

	enum CRStatus
	cr_parser_input_set_cur_pos (CRParserInput *a_this, 
				     CRParserInputPos *a_pos) ;

	enum CRStatus
	cr_parser_input_set_line_num (CRParserInput *a_this, 
				      glong a_line) ;
	
	enum CRStatus
	cr_parser_input_set_col_num (CRParserInput *a_this, 
				     glong a_col) ;
	
	enum CRStatus
	cr_parser_input_incr_line_num (CRParserInput *a_this,
				       glong a_increment) ;

	enum CRStatus
	cr_parser_input_incr_col_num (CRParserInput *a_this,
				      glong a_increment) ;

	enum CRStatus
	cr_parser_input_get_col_num (CRParserInput *a_this, 
				     glong *a_col) ;

	enum CRStatus
	cr_parser_input_get_line_num (CRParserInput *a_this, 
				      glong *a_line) ;
	
	enum CRStatus
        cr_parser_input_get_cur_index (CRParserInput *a_this, 
                                       glong *a_index) ;
	
#ifdef __cplusplus
} /*extern "C" {*/
#endif 

#endif /*__CR_PARSER_INPUT_H__*/