• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 1998-2004  David Turner and Werner Lemberg
3  * Copyright (C) 2006  Behdad Esfahbod
4  *
5  * This is part of HarfBuzz, an OpenType Layout engine library.
6  *
7  * Permission is hereby granted, without written agreement and without
8  * license or royalty fees, to use, copy, modify, and distribute this
9  * software and its documentation for any purpose, provided that the
10  * above copyright notice and the following two paragraphs appear in
11  * all copies of this software.
12  *
13  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
17  * DAMAGE.
18  *
19  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
22  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24  */
25 
26 #ifndef HARFBUZZ_STREAM_PRIVATE_H
27 #define HARFBUZZ_STREAM_PRIVATE_H
28 
29 #include "harfbuzz-impl.h"
30 #include "harfbuzz-stream.h"
31 
32 HB_BEGIN_HEADER
33 
34 HB_INTERNAL void
35 _hb_close_stream( HB_Stream stream );
36 
37 HB_INTERNAL HB_Int
38 _hb_stream_pos( HB_Stream stream );
39 
40 HB_INTERNAL HB_Error
41 _hb_stream_seek( HB_Stream stream,
42                  HB_UInt   pos );
43 
44 HB_INTERNAL HB_Error
45 _hb_stream_frame_enter( HB_Stream stream,
46                         HB_UInt   size );
47 
48 HB_INTERNAL void
49 _hb_stream_frame_exit( HB_Stream stream );
50 
51 /* convenience macros */
52 
53 #define  SET_ERR(c)   ( (error = (c)) != 0 )
54 
55 #define  GOTO_Table(tag) (0)
56 #define  FILE_Pos()      _hb_stream_pos( stream )
57 #define  FILE_Seek(pos)  SET_ERR( _hb_stream_seek( stream, pos ) )
58 #define  ACCESS_Frame(size)  SET_ERR( _hb_stream_frame_enter( stream, size ) )
59 #define  FORGET_Frame()      _hb_stream_frame_exit( stream )
60 
61 #define  GET_Byte()      (*stream->cursor++)
62 #define  GET_Short()     (stream->cursor += 2, (HB_Short)( \
63 				(*(((HB_Byte*)stream->cursor)-2) << 8) | \
64 				 *(((HB_Byte*)stream->cursor)-1) \
65 			 ))
66 #define  GET_Long()      (stream->cursor += 4, (HB_Int)( \
67 				(*(((HB_Byte*)stream->cursor)-4) << 24) | \
68 				(*(((HB_Byte*)stream->cursor)-3) << 16) | \
69 				(*(((HB_Byte*)stream->cursor)-2) << 8) | \
70 				 *(((HB_Byte*)stream->cursor)-1) \
71 			 ))
72 
73 
74 #define  GET_Char()      ((HB_Char)GET_Byte())
75 #define  GET_UShort()    ((HB_UShort)GET_Short())
76 #define  GET_ULong()     ((HB_UInt)GET_Long())
77 #define  GET_Tag4()      GET_ULong()
78 
79 HB_END_HEADER
80 
81 #endif /* HARFBUZZ_STREAM_PRIVATE_H */
82