YAZ
4.2.57
Main Page
Data Structures
Files
File List
Globals
src
cqlstring.c
Go to the documentation of this file.
1
/* This file is part of the YAZ toolkit.
2
* Copyright (C) 1995-2013 Index Data
3
* See the file LICENSE for details.
4
*/
9
#if HAVE_CONFIG_H
10
#include <
config.h
>
11
#endif
12
13
#include <
yaz/cql.h
>
14
15
struct
cql_buf_info
{
16
const
char
*
str
;
17
int
off
;
18
};
19
20
static
int
getbuf
(
void
*vp)
21
{
22
struct
cql_buf_info
*bi = (
struct
cql_buf_info
*) vp;
23
if
(bi->
str
[bi->
off
] == 0)
24
return
0;
25
return
bi->
str
[bi->
off
++];
26
}
27
28
static
void
ungetbuf
(
int
b,
void
*vp)
29
{
30
struct
cql_buf_info
*bi = (
struct
cql_buf_info
*) vp;
31
if
(b)
32
(bi->
off
--);
33
}
34
35
int
cql_parser_string
(
CQL_parser
cp,
const
char
*
str
)
36
{
37
struct
cql_buf_info
b;
38
39
b.
str
=
str
;
40
b.
off
= 0;
41
42
return
cql_parser_stream
(cp,
getbuf
,
ungetbuf
, &b);
43
}
44
45
/*
46
* Local variables:
47
* c-basic-offset: 4
48
* c-file-style: "Stroustrup"
49
* indent-tabs-mode: nil
50
* End:
51
* vim: shiftwidth=4 tabstop=8 expandtab
52
*/
53
Generated on Wed May 15 2013 14:55:30 for YAZ by
1.8.1.2