updated manual & compresslevel cleanup (HH)
[luatex.git] / source / texk / web2c / luatexdir / utils / managed-sa.h
blobd23e3574a40d25ab65ed74ac1b881dbf8ac8d7f7
1 /* managed-sa.h
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/>. */
21 #ifndef MANAGED_SA_H
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 */
27 # define HIGHPART 128
28 # define MIDPART 128
29 # define LOWPART 128
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)))
39 typedef union {
40 unsigned int uint_value;
41 int int_value;
42 struct {
43 int value_1;
44 int value_2;
45 } dump_int;
46 struct {
47 unsigned int value_1;
48 unsigned int value_2;
49 } dump_uint;
50 struct {
51 unsigned int character_value:21;
52 unsigned int family_value:8;
53 unsigned int class_value:3;
54 } math_code_value;
55 struct {
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;
62 } del_code_value;
63 } sa_tree_item;
65 typedef struct {
66 int code;
67 int level;
68 sa_tree_item value;
69 } sa_stack_item;
72 typedef struct {
73 int stack_size; /* initial stack size */
74 int stack_step; /* increment stack step */
75 int stack_type;
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 */
80 } sa_tree_head;
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);
99 #endif