| 1 |
/* luatexcallbackids.h |
| 2 |
|
| 3 |
Copyright 2012 Taco Hoekwater <[email protected]> |
| 4 |
|
| 5 |
This file is part of LuaTeX. |
| 6 |
|
| 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. |
| 11 |
|
| 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. |
| 16 |
|
| 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/>. */ |
| 19 |
|
| 20 |
|
| 21 |
#ifndef LUATEXCALLBACKIDS_H |
| 22 |
#define LUATEXCALLBACKIDS_H |
| 23 |
|
| 24 |
typedef enum { |
| 25 |
find_write_file_callback = 1, |
| 26 |
find_output_file_callback, |
| 27 |
find_image_file_callback, |
| 28 |
find_format_file_callback, |
| 29 |
find_read_file_callback, open_read_file_callback, |
| 30 |
find_vf_file_callback, read_vf_file_callback, |
| 31 |
find_data_file_callback, read_data_file_callback, |
| 32 |
find_font_file_callback, read_font_file_callback, |
| 33 |
find_map_file_callback, read_map_file_callback, |
| 34 |
find_enc_file_callback, read_enc_file_callback, |
| 35 |
find_type1_file_callback, read_type1_file_callback, |
| 36 |
find_truetype_file_callback, read_truetype_file_callback, |
| 37 |
find_opentype_file_callback, read_opentype_file_callback, |
| 38 |
find_cidmap_file_callback, read_cidmap_file_callback, |
| 39 |
find_pk_file_callback, read_pk_file_callback, |
| 40 |
show_error_hook_callback, |
| 41 |
process_input_buffer_callback, process_output_buffer_callback, |
| 42 |
process_jobname_callback, |
| 43 |
start_page_number_callback, stop_page_number_callback, |
| 44 |
start_run_callback, stop_run_callback, |
| 45 |
define_font_callback, |
| 46 |
pre_output_filter_callback, |
| 47 |
buildpage_filter_callback, |
| 48 |
hpack_filter_callback, vpack_filter_callback, |
| 49 |
glyph_not_found_callback, |
| 50 |
glyph_info_callback, |
| 51 |
hyphenate_callback, |
| 52 |
ligaturing_callback, |
| 53 |
kerning_callback, |
| 54 |
pre_linebreak_filter_callback, |
| 55 |
linebreak_filter_callback, |
| 56 |
post_linebreak_filter_callback, |
| 57 |
append_to_vlist_filter_callback, |
| 58 |
mlist_to_hlist_callback, |
| 59 |
finish_pdffile_callback, |
| 60 |
finish_pdfpage_callback, |
| 61 |
pre_dump_callback, |
| 62 |
start_file_callback, stop_file_callback, |
| 63 |
show_error_message_callback, show_lua_error_hook_callback,show_ignored_error_message_callback, |
| 64 |
show_warning_message_callback, |
| 65 |
hpack_quality_callback, vpack_quality_callback, |
| 66 |
process_rule_callback, |
| 67 |
insert_local_par_callback, |
| 68 |
contribute_filter_callback, |
| 69 |
call_edit_callback, |
| 70 |
build_page_insert_callback, |
| 71 |
glyph_stream_provider_callback, |
| 72 |
font_descriptor_objnum_provider_callback, |
| 73 |
finish_synctex_callback, |
| 74 |
wrapup_run_callback, |
| 75 |
new_graf_callback, |
| 76 |
page_order_index_callback, |
| 77 |
make_extensible_callback, |
| 78 |
process_pdf_image_content_callback, |
| 79 |
provide_charproc_data_callback, |
| 80 |
input_level_string_callback, |
| 81 |
total_callbacks, |
| 82 |
} callback_callback_types; |
| 83 |
|
| 84 |
/* lcallbacklib.c */ |
| 85 |
|
| 86 |
extern int callback_set[]; |
| 87 |
|
| 88 |
# define callback_defined(a) callback_set[a] |
| 89 |
/* # define callback_defined(a) debug_callback_defined(a) */ |
| 90 |
|
| 91 |
extern int lua_active; |
| 92 |
|
| 93 |
extern int debug_callback_defined(int i); |
| 94 |
|
| 95 |
extern int run_callback(int i, const char *values, ...); |
| 96 |
extern int run_saved_callback(int i, const char *name, const char *values, ...); |
| 97 |
extern int run_and_save_callback(int i, const char *values, ...); |
| 98 |
extern void destroy_saved_callback(int i); |
| 99 |
|
| 100 |
extern void get_saved_lua_boolean(int i, const char *name, boolean * target); |
| 101 |
extern void get_saved_lua_number(int i, const char *name, int *target); |
| 102 |
extern void get_saved_lua_string(int i, const char *name, char **target); |
| 103 |
|
| 104 |
extern void get_lua_boolean(const char *table, const char *name, boolean * target); |
| 105 |
extern void get_lua_number(const char *table, const char *name, int *target); |
| 106 |
extern void get_lua_string(const char *table, const char *name, char **target); |
| 107 |
|
| 108 |
|
| 109 |
extern char *get_lua_name(int i); |
| 110 |
|
| 111 |
/* texfileio.c */ |
| 112 |
extern char *luatex_find_file(const char *s, int callback_index); |
| 113 |
extern int readbinfile(FILE * f, unsigned char **b, int *s); |
| 114 |
|
| 115 |
#define filetype_unknown 0 |
| 116 |
#define filetype_tex 1 |
| 117 |
#define filetype_map 2 |
| 118 |
#define filetype_image 3 |
| 119 |
#define filetype_subset 4 |
| 120 |
#define filetype_font 5 |
| 121 |
|
| 122 |
static const char *const filetypes_left[] = { "?", "(", "{", "<", "<", "<<" } ; |
| 123 |
static const char *const filetypes_right[] = { "?", ")", "}", ">", ">", ">>" } ; |
| 124 |
|
| 125 |
#define report_start_file(left,name) do { \ |
| 126 |
if (tracefilenames) { \ |
| 127 |
int report_id = callback_defined(start_file_callback); \ |
| 128 |
if (report_id == 0) { \ |
| 129 |
if (left == 1) { \ |
| 130 |
/* we only do this for traditional name reporting, normally name is iname */ \ |
| 131 |
if (term_offset + strlen(name) > max_print_line - 2) \ |
| 132 |
print_ln(); \ |
| 133 |
else if ((term_offset > 0) || (file_offset > 0)) \ |
| 134 |
print_char(' '); \ |
| 135 |
tex_printf("%s", filetypes_left[left]); \ |
| 136 |
tprint_file_name(NULL, (unsigned char *) name, NULL); \ |
| 137 |
} else { \ |
| 138 |
tex_printf("%s", filetypes_left[left]); \ |
| 139 |
tex_printf("%s", (unsigned char *) name); \ |
| 140 |
} \ |
| 141 |
} else { \ |
| 142 |
/* (void) run_callback(report_id, "dS->",left,(unsigned char *) fullnameoffile); */ \ |
| 143 |
(void) run_callback(report_id, "dS->",left,name); \ |
| 144 |
} \ |
| 145 |
} \ |
| 146 |
} while (0) |
| 147 |
|
| 148 |
#define report_stop_file(right) do { \ |
| 149 |
if (tracefilenames) { \ |
| 150 |
int report_id = callback_defined(stop_file_callback); \ |
| 151 |
if (report_id == 0) { \ |
| 152 |
tex_printf("%s", filetypes_right[right]); \ |
| 153 |
} else { \ |
| 154 |
(void) run_callback(report_id, "d->",right); \ |
| 155 |
} \ |
| 156 |
} \ |
| 157 |
} while (0) |
| 158 |
|
| 159 |
#endif |
| 160 |
|
| 161 |
#define normal_page_filter(A) lua_node_filter_s(buildpage_filter_callback,lua_key_index(A)) |
| 162 |
#define checked_page_filter(A) if (!output_active) lua_node_filter_s(buildpage_filter_callback,lua_key_index(A)) |
| 163 |
#define checked_break_filter(A) if (!output_active) lua_node_filter_s(contribute_filter_callback,lua_key_index(A)) |