]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sys/contrib/ia64/libuwx/src/uwx_bstream.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / sys / contrib / ia64 / libuwx / src / uwx_bstream.h
1 /*
2 Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P.
3 Permission is hereby granted, free of charge, to any person
4 obtaining a copy of this software and associated documentation
5 files (the "Software"), to deal in the Software without
6 restriction, including without limitation the rights to use,
7 copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the
9 Software is furnished to do so, subject to the following
10 conditions:
11
12 The above copyright notice and this permission notice shall be
13 included in all copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25 struct uwx_bstream {
26     copyin_cb copyin;
27     intptr_t cb_token;
28     uint64_t source;
29     uint64_t buf;
30     unsigned char *bufp;
31     int nbuf;
32     unsigned int ntotal;
33     int request;
34     int peekc;
35 };
36
37 /* uwx_init_bstream: initialize a byte stream for reading */
38
39 extern void uwx_init_bstream(
40     struct uwx_bstream *bstream,
41     struct uwx_env *env,
42     uint64_t source,
43     unsigned int len,
44     int request);
45
46
47 /* uwx_get_byte: read the next byte from the byte stream */
48
49 extern int uwx_get_byte(struct uwx_bstream *bstream);
50
51
52 /* uwx_unget_byte: push a byte back onto the byte stream */
53
54 extern int uwx_unget_byte(struct uwx_bstream *bstream, int b);
55
56
57 /* uwx_get_uleb128: read a ULEB128 value from the byte stream */
58
59 extern int uwx_get_uleb128(struct uwx_bstream *bstream, uint64_t *val);