Edinburgh Speech Tools
2.1-release
input.h
Go to the documentation of this file.
1
/*************************************************************************/
2
/* */
3
/* Copyright (c) 1997-98 Richard Tobin, Language Technology Group, HCRC, */
4
/* University of Edinburgh. */
5
/* */
6
/* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, */
7
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
8
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
9
/* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF EDINBURGH BE LIABLE */
10
/* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */
11
/* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION */
12
/* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
13
/* */
14
/*************************************************************************/
15
#ifndef INPUT_H
16
#define INPUT_H
17
18
#ifndef FOR_LT
19
#define XML_API
20
#endif
21
22
#include <stdio.h>
23
#include "
charset.h
"
24
#include "
stdio16.h
"
25
#include "
dtd.h
"
26
27
/* Typedefs */
28
29
typedef
struct
input_source
*InputSource;
30
typedef
struct
stream_ops *
StreamOps
;
31
typedef
int
ReadProc
(
StreamOps
ops,
unsigned
char
*buf,
int
max_count);
32
typedef
int
WriteProc
(
StreamOps
ops,
unsigned
char
*buf,
int
count);
33
typedef
void
CloseProc
(
StreamOps
ops);
34
typedef
int
SeekProc
(
StreamOps
ops,
int
offset);
35
36
/* Input sources */
37
38
XML_API
InputSource
SourceFromStream
(
const
char8
*description, FILE *file);
39
XML_API
InputSource
EntityOpen
(Entity e);
40
XML_API
InputSource
NewInputSource
(Entity e, FILE16 *f16);
41
XML_API
int
SourceTell
(InputSource s);
42
XML_API
int
SourceSeek
(InputSource s,
int
offset);
43
XML_API
int
SourceLineAndChar
(InputSource s,
int
*linenum,
int
*charnum);
44
XML_API
void
SourcePosition
(InputSource s, Entity *
entity
,
int
*char_number);
45
XML_API
int
get_with_fill
(InputSource s);
46
XML_API
void
determine_character_encoding
(InputSource s);
47
48
struct
input_source
{
49
Entity
entity
;
/* The entity from which the source reads */
50
51
FILE16 *
file16
;
52
53
Char *
line
;
54
int
line_alloc
,
line_length
;
55
int
next
;
56
57
int
seen_eoe
;
58
int
complicated_utf8_line
;
59
int
bytes_consumed
;
60
int
bytes_before_current_line
;
61
int
line_end_was_cr
;
62
63
int
line_number
;
64
int
not_read_yet
;
65
66
struct
input_source
*
parent
;
67
68
int
nextin
;
69
int
insize
;
70
unsigned
char
inbuf
[4096];
71
};
72
73
/* EOE used to be -2, but that doesn't work if Char is signed char */
74
#define XEOE (-999)
75
76
#define at_eol(s) ((s)->next == (s)->line_length)
77
#define get(s) (at_eol(s) ? get_with_fill(s) : (s)->line[(s)->next++])
78
#define unget(s) ((s)->seen_eoe ? (s)->seen_eoe= 0 : (s)->next--)
79
80
#endif
/* INPUT_H */
ReadProc
int ReadProc(StreamOps ops, unsigned char *buf, int max_count)
Definition:
input.h:31
SourceLineAndChar
XML_API int SourceLineAndChar(InputSource s, int *linenum, int *charnum)
Definition:
input.c:118
input_source::nextin
int nextin
Definition:
input.h:68
input_source::line_length
int line_length
Definition:
input.h:54
input_source::complicated_utf8_line
int complicated_utf8_line
Definition:
input.h:58
get_with_fill
XML_API int get_with_fill(InputSource s)
Definition:
input.c:529
SeekProc
int SeekProc(StreamOps ops, int offset)
Definition:
input.h:34
charset.h
input_source::line_end_was_cr
int line_end_was_cr
Definition:
input.h:61
NewInputSource
XML_API InputSource NewInputSource(Entity e, FILE16 *f16)
Definition:
input.c:88
input_source::line
Char * line
Definition:
input.h:53
determine_character_encoding
XML_API void determine_character_encoding(InputSource s)
Definition:
input.c:480
entity
Definition:
dtd.h:71
input_source
Definition:
input.h:48
EntityOpen
XML_API InputSource EntityOpen(Entity e)
Definition:
input.c:68
input_source::seen_eoe
int seen_eoe
Definition:
input.h:57
SourceTell
XML_API int SourceTell(InputSource s)
Definition:
input.c:163
CloseProc
void CloseProc(StreamOps ops)
Definition:
input.h:33
input_source::file16
FILE16 * file16
Definition:
input.h:51
input_source::bytes_before_current_line
int bytes_before_current_line
Definition:
input.h:60
input_source::line_number
int line_number
Definition:
input.h:63
input_source::insize
int insize
Definition:
input.h:69
input_source::entity
Entity entity
Definition:
input.h:49
input_source::not_read_yet
int not_read_yet
Definition:
input.h:64
XML_API
#define XML_API
Definition:
input.h:19
stdio16.h
input_source::parent
struct input_source * parent
Definition:
input.h:66
input_source::inbuf
unsigned char inbuf[4096]
Definition:
input.h:70
input_source::next
int next
Definition:
input.h:55
input_source::bytes_consumed
int bytes_consumed
Definition:
input.h:59
StreamOps
struct stream_ops * StreamOps
Definition:
input.h:30
WriteProc
int WriteProc(StreamOps ops, unsigned char *buf, int count)
Definition:
input.h:32
dtd.h
char8
char char8
Definition:
charset.h:31
input_source::line_alloc
int line_alloc
Definition:
input.h:54
SourceSeek
XML_API int SourceSeek(InputSource s, int offset)
Definition:
input.c:221
SourceFromStream
XML_API InputSource SourceFromStream(const char8 *description, FILE *file)
Definition:
input.c:57
SourcePosition
XML_API void SourcePosition(InputSource s, Entity *entity, int *char_number)
Definition:
input.c:157
include
rxp
input.h
Generated on Fri Oct 6 2017 18:25:28 for Edinburgh Speech Tools by
1.8.11