1 /* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
2 
3 /*
4  * This file is part of The Croco Library
5  *
6  * Copyright (C) 2002-2003 Dodji Seketeli <dodji@seketeli.org>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of version 2.1 of the GNU Lesser General Public
10  * License as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  * USA
21  */
22 
23 #ifndef __CR_PARSER_INPUT_H__
24 #define __CR_PARSER_INPUT_H__
25 
26 #include "cr-input.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 	typedef struct _CRParserInput CRParserInput ;
33 	typedef struct _CRParserInputPriv CRParserInputPriv ;
34 
35 	struct _CRParserInput
36 	{
37 		CRParserInputPriv *priv ;
38 	} ;
39 
40 	typedef struct _CRParserInputPos CRParserInputPos ;
41 
42 	struct _CRParserInputPos
43 	{
44 		CRInputPos input_pos ;
45 
46 		/*not used yet*/
47 		glong stack_size ;
48 	} ;
49 
50 	CRParserInput *
51 	cr_parser_input_new_from_uri (gchar *a_uri, enum CREncoding) ;
52 
53 	void
54 	cr_parser_input_ref (CRParserInput *a_this) ;
55 
56 	gboolean
57 	cr_parser_input_unref (CRParserInput *a_this) ;
58 
59 	void
60 	cr_parser_input_destroy (CRParserInput *a_this) ;
61 
62 	enum CRStatus
63 	cr_parser_input_push_input (CRParserInput *a_this,
64 				    CRInput *a_input) ;
65 
66 	enum CRStatus
67 	cr_parser_input_pop_input (CRParserInput *a_this) ;
68 
69 	CRInput *
70 	cr_parser_input_peek_input (CRParserInput *a_this) ;
71 
72 	enum CRStatus
73 	cr_parser_input_get_byte_addr (CRParserInput *a_this,
74 				       gulong a_offset,
75 				       guchar **a_addr) ;
76 
77 	enum CRStatus
78 	cr_parser_input_get_cur_byte_addr (CRParserInput *a_this,
79 					   guchar **a_addr) ;
80 	enum CRStatus
81 	cr_parser_input_read_byte (CRParserInput *a_this,
82 				   guchar * a_byte) ;
83 
84 	enum CRStatus
85 	cr_parser_input_read_char (CRParserInput *a_this,
86 				   guint32 * a_byte) ;
87 
88 	enum CRStatus
89         cr_parser_input_get_end_of_file (CRParserInput *a_this,
90 					 gboolean *a_eof) ;
91 
92 	enum CRStatus
93 	cr_parser_input_consume_char (CRParserInput *a_this,
94 				      guint32 a_char) ;
95 
96 	enum CRStatus
97 	cr_parser_input_consume_chars (CRParserInput *a_this,
98 				       guint32 a_char,
99 				       glong *a_nb_char) ;
100 
101 	enum CRStatus
102 	cr_parser_input_consume_spaces (CRParserInput *a_this,
103 					glong *a_nb_char) ;
104 
105 	enum CRStatus
106 	cr_parser_input_peek_byte (CRParserInput *a_this,
107 				   enum CRSeekPos a_origin,
108 				   gulong a_offset, guchar *a_byte) ;
109 
110 	enum CRStatus
111 	cr_parser_input_peek_char (CRParserInput *a_this,
112 				   guint32 *a_char) ;
113 
114 	glong
115 	cr_parser_input_get_nb_bytes_left (CRParserInput *a_this) ;
116 
117 	enum CRStatus
118 	cr_parser_input_seek_index (CRParserInput *a_this,
119 				    enum CRSeekPos a_origin,
120 				    gint a_pos) ;
121 
122 	enum CRStatus
123 	cr_parser_input_get_cur_pos (CRParserInput *a_this,
124 				     CRParserInputPos *a_pos) ;
125 
126 	enum CRStatus
127 	cr_parser_input_set_cur_pos (CRParserInput *a_this,
128 				     CRParserInputPos *a_pos) ;
129 
130 	enum CRStatus
131 	cr_parser_input_set_line_num (CRParserInput *a_this,
132 				      glong a_line) ;
133 
134 	enum CRStatus
135 	cr_parser_input_set_col_num (CRParserInput *a_this,
136 				     glong a_col) ;
137 
138 	enum CRStatus
139 	cr_parser_input_incr_line_num (CRParserInput *a_this,
140 				       glong a_increment) ;
141 
142 	enum CRStatus
143 	cr_parser_input_incr_col_num (CRParserInput *a_this,
144 				      glong a_increment) ;
145 
146 	enum CRStatus
147 	cr_parser_input_get_col_num (CRParserInput *a_this,
148 				     glong *a_col) ;
149 
150 	enum CRStatus
151 	cr_parser_input_get_line_num (CRParserInput *a_this,
152 				      glong *a_line) ;
153 
154 	enum CRStatus
155         cr_parser_input_get_cur_index (CRParserInput *a_this,
156                                        glong *a_index) ;
157 
158 #ifdef __cplusplus
159 } /*extern "C" {*/
160 #endif
161 
162 #endif /*__CR_PARSER_INPUT_H__*/
163