File: luatexcallbackids.h

package info (click to toggle)
texlive-bin 2018.20181218.49446-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 186,920 kB
  • sloc: ansic: 873,264; cpp: 311,278; perl: 82,918; sh: 23,243; makefile: 8,590; lex: 4,939; python: 4,462; pascal: 3,813; java: 3,569; yacc: 2,901; tcl: 2,379; exp: 2,031; xml: 844; ruby: 678; lisp: 398; sed: 331; asm: 140; csh: 46; awk: 30
file content (155 lines) | stat: -rw-r--r-- 5,899 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/* luatexcallbackids.h

   Copyright 2012 Taco Hoekwater <taco@luatex.org>

   This file is part of LuaTeX.

   LuaTeX is free software; you can redistribute it and/or modify it under
   the terms of the GNU General Public License as published by the Free
   Software Foundation; either version 2 of the License, or (at your
   option) any later version.

   LuaTeX is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
   License for more details.

   You should have received a copy of the GNU General Public License along
   with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */


#ifndef LUATEXCALLBACKIDS_H
#define LUATEXCALLBACKIDS_H

typedef enum {
    find_write_file_callback = 1,
    find_output_file_callback,
    find_image_file_callback,
    find_format_file_callback,
    find_read_file_callback, open_read_file_callback,
    find_vf_file_callback, read_vf_file_callback,
    find_data_file_callback, read_data_file_callback,
    find_font_file_callback, read_font_file_callback,
    find_map_file_callback, read_map_file_callback,
    find_enc_file_callback, read_enc_file_callback,
    find_type1_file_callback, read_type1_file_callback,
    find_truetype_file_callback, read_truetype_file_callback,
    find_opentype_file_callback, read_opentype_file_callback,
    find_cidmap_file_callback, read_cidmap_file_callback,
    find_pk_file_callback, read_pk_file_callback,
    show_error_hook_callback,
    process_input_buffer_callback, process_output_buffer_callback,
    process_jobname_callback,
    start_page_number_callback, stop_page_number_callback,
    start_run_callback, stop_run_callback,
    define_font_callback,
    pre_output_filter_callback,
    buildpage_filter_callback,
    hpack_filter_callback, vpack_filter_callback,
    glyph_not_found_callback,
    hyphenate_callback,
    ligaturing_callback,
    kerning_callback,
    pre_linebreak_filter_callback,
    linebreak_filter_callback,
    post_linebreak_filter_callback,
    append_to_vlist_filter_callback,
    mlist_to_hlist_callback,
    finish_pdffile_callback,
    finish_pdfpage_callback,
    pre_dump_callback,
    start_file_callback, stop_file_callback,
    show_error_message_callback, show_lua_error_hook_callback,
    show_warning_message_callback,
    hpack_quality_callback, vpack_quality_callback,
    process_rule_callback,
    insert_local_par_callback,
    contribute_filter_callback,
    call_edit_callback,
    build_page_insert_callback,
    glyph_stream_provider_callback,
    finish_synctex_callback,
    total_callbacks
} callback_callback_types;

/* lcallbacklib.c */

extern int callback_set[];

#  define callback_defined(a) callback_set[a]
/* #  define callback_defined(a) debug_callback_defined(a) */

extern int lua_active;

extern int debug_callback_defined(int i);

extern int run_callback(int i, const char *values, ...);
extern int run_saved_callback(int i, const char *name, const char *values, ...);
extern int run_and_save_callback(int i, const char *values, ...);
extern void destroy_saved_callback(int i);

extern void get_saved_lua_boolean(int i, const char *name, boolean * target);
extern void get_saved_lua_number(int i, const char *name, int *target);
extern void get_saved_lua_string(int i, const char *name, char **target);

extern void get_lua_boolean(const char *table, const char *name, boolean * target);
extern void get_lua_number(const char *table, const char *name, int *target);
extern void get_lua_string(const char *table, const char *name, char **target);

extern int lua_reader_callback(int callback_id, pointer *buffloc);

extern char *get_lua_name(int i);

/* texfileio.c */
extern char *luatex_find_file(const char *s, int callback_index);
extern int readbinfile(FILE * f, unsigned char **b, int *s);

#define filetype_unknown 0
#define filetype_tex     1
#define filetype_map     2
#define filetype_image   3
#define filetype_subset  4
#define filetype_font    5

static const char *const filetypes_left[]  = { "?", "(", "{", "<", "<", "<<" } ;
static const char *const filetypes_right[] = { "?", ")", "}", ">", ">", ">>" } ;

#define report_start_file(left,name) do { \
    if (tracefilenames) { \
        int report_id = callback_defined(start_file_callback); \
        if (report_id == 0) { \
            if (left == 1) { \
                /* we only do this for traditional name reporting, normally name is iname */ \
                if (term_offset + strlen(name) > max_print_line - 2) \
                    print_ln(); \
                else if ((term_offset > 0) || (file_offset > 0)) \
                    print_char(' '); \
                tex_printf("%s", filetypes_left[left]); \
                tprint_file_name(NULL, (unsigned char *) name, NULL); \
            } else { \
                tex_printf("%s", filetypes_left[left]); \
                tex_printf("%s", (unsigned char *) name); \
            } \
        } else { \
          /*  (void) run_callback(report_id, "dS->",left,(unsigned char *) fullnameoffile); */ \
            (void) run_callback(report_id, "dS->",left,name); \
        } \
    } \
} while (0)

#define report_stop_file(right) do { \
    if (tracefilenames) { \
        int report_id = callback_defined(stop_file_callback); \
        if (report_id == 0) { \
            tex_printf("%s", filetypes_right[right]); \
        } else { \
            (void) run_callback(report_id, "d->",right); \
        } \
    } \
} while (0)

#endif

#define normal_page_filter(A) lua_node_filter_s(buildpage_filter_callback,lua_key_index(A))
#define checked_page_filter(A) if (!output_active) lua_node_filter_s(buildpage_filter_callback,lua_key_index(A))
#define checked_break_filter(A) if (!output_active) lua_node_filter_s(contribute_filter_callback,lua_key_index(A))