15569331642446be05292e3e1f8a51218827168cdclaireho/*
25569331642446be05292e3e1f8a51218827168cdclaireho * Copyright (C) 1998-2004  David Turner and Werner Lemberg
35569331642446be05292e3e1f8a51218827168cdclaireho * Copyright (C) 2006  Behdad Esfahbod
45569331642446be05292e3e1f8a51218827168cdclaireho *
55569331642446be05292e3e1f8a51218827168cdclaireho * This is part of HarfBuzz, an OpenType Layout engine library.
65569331642446be05292e3e1f8a51218827168cdclaireho *
75569331642446be05292e3e1f8a51218827168cdclaireho * Permission is hereby granted, without written agreement and without
85569331642446be05292e3e1f8a51218827168cdclaireho * license or royalty fees, to use, copy, modify, and distribute this
95569331642446be05292e3e1f8a51218827168cdclaireho * software and its documentation for any purpose, provided that the
105569331642446be05292e3e1f8a51218827168cdclaireho * above copyright notice and the following two paragraphs appear in
115569331642446be05292e3e1f8a51218827168cdclaireho * all copies of this software.
125569331642446be05292e3e1f8a51218827168cdclaireho *
135569331642446be05292e3e1f8a51218827168cdclaireho * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
145569331642446be05292e3e1f8a51218827168cdclaireho * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
155569331642446be05292e3e1f8a51218827168cdclaireho * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
165569331642446be05292e3e1f8a51218827168cdclaireho * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
175569331642446be05292e3e1f8a51218827168cdclaireho * DAMAGE.
185569331642446be05292e3e1f8a51218827168cdclaireho *
195569331642446be05292e3e1f8a51218827168cdclaireho * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
205569331642446be05292e3e1f8a51218827168cdclaireho * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
215569331642446be05292e3e1f8a51218827168cdclaireho * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
225569331642446be05292e3e1f8a51218827168cdclaireho * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
235569331642446be05292e3e1f8a51218827168cdclaireho * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
245569331642446be05292e3e1f8a51218827168cdclaireho */
255569331642446be05292e3e1f8a51218827168cdclaireho
265569331642446be05292e3e1f8a51218827168cdclaireho#ifndef HARFBUZZ_STREAM_PRIVATE_H
275569331642446be05292e3e1f8a51218827168cdclaireho#define HARFBUZZ_STREAM_PRIVATE_H
285569331642446be05292e3e1f8a51218827168cdclaireho
295569331642446be05292e3e1f8a51218827168cdclaireho#include "harfbuzz-impl.h"
305569331642446be05292e3e1f8a51218827168cdclaireho#include "harfbuzz-stream.h"
315569331642446be05292e3e1f8a51218827168cdclaireho
325569331642446be05292e3e1f8a51218827168cdclairehoHB_BEGIN_HEADER
335569331642446be05292e3e1f8a51218827168cdclaireho
345569331642446be05292e3e1f8a51218827168cdclairehoHB_INTERNAL void
355569331642446be05292e3e1f8a51218827168cdclaireho_hb_close_stream( HB_Stream stream );
365569331642446be05292e3e1f8a51218827168cdclaireho
375569331642446be05292e3e1f8a51218827168cdclairehoHB_INTERNAL HB_Int
385569331642446be05292e3e1f8a51218827168cdclaireho_hb_stream_pos( HB_Stream stream );
395569331642446be05292e3e1f8a51218827168cdclaireho
405569331642446be05292e3e1f8a51218827168cdclairehoHB_INTERNAL HB_Error
415569331642446be05292e3e1f8a51218827168cdclaireho_hb_stream_seek( HB_Stream stream,
425569331642446be05292e3e1f8a51218827168cdclaireho                 HB_UInt   pos );
435569331642446be05292e3e1f8a51218827168cdclaireho
445569331642446be05292e3e1f8a51218827168cdclairehoHB_INTERNAL HB_Error
455569331642446be05292e3e1f8a51218827168cdclaireho_hb_stream_frame_enter( HB_Stream stream,
465569331642446be05292e3e1f8a51218827168cdclaireho                        HB_UInt   size );
475569331642446be05292e3e1f8a51218827168cdclaireho
485569331642446be05292e3e1f8a51218827168cdclairehoHB_INTERNAL void
495569331642446be05292e3e1f8a51218827168cdclaireho_hb_stream_frame_exit( HB_Stream stream );
505569331642446be05292e3e1f8a51218827168cdclaireho
515569331642446be05292e3e1f8a51218827168cdclaireho/* convenience macros */
525569331642446be05292e3e1f8a51218827168cdclaireho
535569331642446be05292e3e1f8a51218827168cdclaireho#define  SET_ERR(c)   ( (error = (c)) != 0 )
545569331642446be05292e3e1f8a51218827168cdclaireho
555569331642446be05292e3e1f8a51218827168cdclaireho#define  GOTO_Table(tag) (0)
565569331642446be05292e3e1f8a51218827168cdclaireho#define  FILE_Pos()      _hb_stream_pos( stream )
575569331642446be05292e3e1f8a51218827168cdclaireho#define  FILE_Seek(pos)  SET_ERR( _hb_stream_seek( stream, pos ) )
585569331642446be05292e3e1f8a51218827168cdclaireho#define  ACCESS_Frame(size)  SET_ERR( _hb_stream_frame_enter( stream, size ) )
595569331642446be05292e3e1f8a51218827168cdclaireho#define  FORGET_Frame()      _hb_stream_frame_exit( stream )
605569331642446be05292e3e1f8a51218827168cdclaireho
615569331642446be05292e3e1f8a51218827168cdclaireho#define  GET_Byte()      (*stream->cursor++)
625569331642446be05292e3e1f8a51218827168cdclaireho#define  GET_Short()     (stream->cursor += 2, (HB_Short)( \
635569331642446be05292e3e1f8a51218827168cdclaireho				(*(((HB_Byte*)stream->cursor)-2) << 8) | \
645569331642446be05292e3e1f8a51218827168cdclaireho				 *(((HB_Byte*)stream->cursor)-1) \
655569331642446be05292e3e1f8a51218827168cdclaireho			 ))
665569331642446be05292e3e1f8a51218827168cdclaireho#define  GET_Long()      (stream->cursor += 4, (HB_Int)( \
675569331642446be05292e3e1f8a51218827168cdclaireho				(*(((HB_Byte*)stream->cursor)-4) << 24) | \
685569331642446be05292e3e1f8a51218827168cdclaireho				(*(((HB_Byte*)stream->cursor)-3) << 16) | \
695569331642446be05292e3e1f8a51218827168cdclaireho				(*(((HB_Byte*)stream->cursor)-2) << 8) | \
705569331642446be05292e3e1f8a51218827168cdclaireho				 *(((HB_Byte*)stream->cursor)-1) \
715569331642446be05292e3e1f8a51218827168cdclaireho			 ))
725569331642446be05292e3e1f8a51218827168cdclaireho
735569331642446be05292e3e1f8a51218827168cdclaireho
745569331642446be05292e3e1f8a51218827168cdclaireho#define  GET_Char()      ((HB_Char)GET_Byte())
755569331642446be05292e3e1f8a51218827168cdclaireho#define  GET_UShort()    ((HB_UShort)GET_Short())
765569331642446be05292e3e1f8a51218827168cdclaireho#define  GET_ULong()     ((HB_UInt)GET_Long())
775569331642446be05292e3e1f8a51218827168cdclaireho#define  GET_Tag4()      GET_ULong()
785569331642446be05292e3e1f8a51218827168cdclaireho
795569331642446be05292e3e1f8a51218827168cdclairehoHB_END_HEADER
805569331642446be05292e3e1f8a51218827168cdclaireho
815569331642446be05292e3e1f8a51218827168cdclaireho#endif /* HARFBUZZ_STREAM_PRIVATE_H */
82