3 Copyright 2006-2010 Taco Hoekwater <taco@luatex.org>
5 This file is part of LuaTeX.
7 LuaTeX is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2 of the License, or (at your
10 option) any later version.
12 LuaTeX is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 License for more details.
17 You should have received a copy of the GNU General Public License along
18 with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
22 # define MANAGED_SA_H 1
24 /* the next two sets of three had better match up exactly, but using bare numbers
25 is easier on the C compiler */
31 # define HIGHPART_PART(a) (((a)>>14)&127)
32 # define MIDPART_PART(a) (((a)>>7)&127)
33 # define LOWPART_PART(a) ((a)&127)
35 # define Mxmalloc_array(a,b) xmalloc((unsigned)((unsigned)(b)*sizeof(a)))
36 # define Mxcalloc_array(a,b) xcalloc((b),sizeof(a))
37 # define Mxrealloc_array(a,b,c) xrealloc((a),(unsigned)((unsigned)(c)*sizeof(b)))
40 unsigned int uint_value
;
51 unsigned int character_value
:21;
52 unsigned int family_value
:8;
53 unsigned int class_value
:3;
56 unsigned int small_character_value
:21;
57 unsigned int small_family_value
:8;
58 unsigned int class_value
:3;
59 unsigned int large_character_value
:21;
60 unsigned int large_family_value
:8;
61 unsigned int dummy_value
:3;
73 int stack_size
; /* initial stack size */
74 int stack_step
; /* increment stack step */
76 int stack_ptr
; /* current stack point */
77 sa_tree_item
***tree
; /* item tree head */
78 sa_stack_item
*stack
; /* stack tree head */
79 sa_tree_item dflt
; /* default item value */
82 typedef sa_tree_head
*sa_tree
;
84 extern sa_tree_item
get_sa_item(const sa_tree head
, const int n
);
85 extern void set_sa_item(sa_tree head
, int n
, sa_tree_item v
, int gl
);
86 extern void rawset_sa_item(sa_tree head
, int n
, sa_tree_item v
);
88 extern sa_tree
new_sa_tree(int size
, int type
, sa_tree_item dflt
);
90 extern sa_tree
copy_sa_tree(sa_tree head
);
91 extern void destroy_sa_tree(sa_tree head
);
93 extern void dump_sa_tree(sa_tree a
, const char * name
);
94 extern sa_tree
undump_sa_tree(const char * name
);
96 extern void restore_sa_stack(sa_tree a
, int gl
);
97 extern void clear_sa_stack(sa_tree a
);