diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2009-03-27 15:30:55 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2009-03-27 15:30:55 +0000 |
commit | 178de0871d690556af74f3768c11bc812b07f347 (patch) | |
tree | a939c31adc90d6207848effaec87dd78ec00e658 /Build/source/texk/web2c/luatexdir/ptexlib.h | |
parent | 4865b23b5199697829e4e6633f2f697b4634c462 (diff) |
Import of luatex 0.37.0 (autoreconf has not been run yet!)
git-svn-id: svn://tug.org/texlive/trunk@12529 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/ptexlib.h')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/ptexlib.h | 359 |
1 files changed, 296 insertions, 63 deletions
diff --git a/Build/source/texk/web2c/luatexdir/ptexlib.h b/Build/source/texk/web2c/luatexdir/ptexlib.h index aad25eb4ab2..90b16589ed0 100644 --- a/Build/source/texk/web2c/luatexdir/ptexlib.h +++ b/Build/source/texk/web2c/luatexdir/ptexlib.h @@ -1,28 +1,30 @@ -/* - Copyright (c) 1996-2006 Han The Thanh, <thanh@pdftex.org> +/* ptexlib.h + + Copyright 1996-2006 Han The Thanh <thanh@pdftex.org> + Copyright 2006-2009 Taco Hoekwater <taco@luatex.org> -This file is part of luatex. + 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 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 General Public License for more details. + 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, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + You should have received a copy of the GNU General Public License along + with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ -$Id$ -*/ +/* $Id$ */ #ifndef LUATEXLIB # define LUATEXLIB +#define SVN_REV "unknown" /* temp hack */ + /* WEB2C macros and prototypes */ # if !defined(LUATEXCOERCE) # ifdef luatex @@ -32,14 +34,69 @@ $Id$ # include "luatexd.h" # endif +# ifdef MSVC +extern double rint(double x); +# endif + /* pdftexlib macros */ # include "ptexmac.h" -# include "avlstuff.h" +/* synctex */ +# include "utils/synctex.h" + +# include "utils/avlstuff.h" # include "image/image.h" # include "openbsd-compat.h" +/***********************************************************************/ +/* from pdfpage.c */ + +typedef struct { + long m; /* mantissa (significand) */ + int e; /* exponent * -1 */ +} pdffloat; + +typedef struct { + pdffloat h; + pdffloat v; +} pdfpos; + +typedef enum { PMODE_NONE, PMODE_PAGE, PMODE_TEXT, PMODE_CHARARRAY, + PMODE_CHAR +} pos_mode; + +typedef enum { WMODE_H, WMODE_V } writing_mode; /* []TJ runs horizontal or vertical */ + +# define is_pagemode(p) ((p)->mode == PMODE_PAGE) +# define is_textmode(p) ((p)->mode == PMODE_TEXT) +# define is_chararraymode(p) ((p)->mode == PMODE_CHARARRAY) +# define is_charmode(p) ((p)->mode == PMODE_CHAR) + +# define setpdffloat(a,b,c) {(a).m = (b); (a).e = (c);} + +typedef struct { + pdfpos pdf; /* pos. on page (PDF page raster) */ + pdfpos pdf_bt_pos; /* pos. at begin of BT-ET group (PDF page raster) */ + pdfpos pdf_tj_pos; /* pos. at begin of TJ array (PDF page raster) */ + pdffloat cw; /* pos. within [(..)..]TJ array (glyph raster); + cw.e = fractional digits in /Widths array */ + pdffloat tj_delta; /* rel. movement in [(..)..]TJ array (glyph raster) */ + pdffloat fs; /* font size in PDF units */ + pdffloat hz; /* HZ expansion factor */ + pdffloat ext; /* ExtendFont factor */ + pdffloat cm[6]; /* cm array */ + pdffloat tm[6]; /* Tm array */ + double k1; /* conv. factor from TeX sp to PDF page raster */ + double k2; /* conv. factor from PDF page raster to TJ array raster */ + internal_font_number f_cur; /* TeX font number */ + internal_font_number f_pdf; /* /F* font number, of unexpanded base font! */ + writing_mode wmode; /* PDF writing mode WMode (horizontal/vertical) */ + pos_mode mode; /* current positioning mode */ +} pdfstructure; + +/***********************************************************************/ + /* pdftexlib type declarations */ typedef struct { const char *pdfname; @@ -75,6 +132,11 @@ typedef struct { char *unicode_seq; /* multiple unicode sequence */ } glyph_unicode_entry; +# define FD_FLAGS_NOT_SET_IN_MAPLINE -1 +# define FD_FLAGS_DEFAULT_EMBED 4 /* a symbol font */ +# define FD_FLAGS_DEFAULT_NON_EMBED 0x22 + /* a nonsymbolic serif font */ + typedef struct { /* parameters scanned from the map file: */ char *tfm_name; /* TFM file name (1st field in map line) */ @@ -95,11 +157,10 @@ typedef struct { } fm_entry; typedef struct glw_entry_ { /* subset glyphs for inclusion in CID-based fonts */ - unsigned short id; /* glyph CID */ - unsigned short wd; /* glyph width in 1/1000 em parts */ + unsigned int id; /* glyph CID */ + signed int wd; /* glyph width in 1/1000 em parts */ } glw_entry; - /**********************************************************************/ typedef struct { @@ -164,6 +225,16 @@ extern size_t last_ptr_index; int loadpoolstrings(integer spare_size); +/* filename.c */ +extern void scan_file_name(void); +extern void pack_job_name(char *s); +extern void prompt_file_name(char *s, char *e); +extern str_number make_name_string(void); +extern void print_file_name(str_number, str_number, str_number); + +/* A hack to counter fixwrites */ +# define do_write_wterm(a) fprintf(stdout, "%s", a) + /* pdftexlib function prototypes */ /* epdf.c */ @@ -183,6 +254,7 @@ extern void pdf_init_map_file(string map_name); extern fm_entry *new_fm_entry(void); extern void delete_fm_entry(fm_entry *); extern int avl_do_entry(fm_entry *, int); +extern int check_std_t1font(char *s); /* papersiz.c */ extern integer myatodim(char **); @@ -201,9 +273,8 @@ extern void def_tounicode(strnumber, strnumber); extern integer write_tounicode(char **, char *); /* utils.c */ -extern boolean str_eq_cstr(strnumber, char *); extern char *makecstring(integer); -extern char *makeclstring(integer, int *); +extern char *makeclstring(integer, size_t *); extern void print_string(char *j); extern void append_string(char *s); extern void getcreationdate(void); @@ -211,6 +282,7 @@ extern void tconfusion(char *s); extern void tprint(char *s); extern void tprint_nl(char *s); extern void tprint_esc(char *s); +extern char *stripzeros(char *); # define overflow_string(a,b) { overflow(maketexstring(a),b); flush_str(last_tex_string); } @@ -239,7 +311,7 @@ extern void pdftex_warn(const char *, ...); extern void set_job_id(int, int, int, int); __attribute__ ((format(printf, 1, 2))) extern void tex_printf(const char *, ...); -extern void write_stream_length(integer, integer); +extern void write_stream_length(integer, longinteger); extern char *convertStringToPDFString(const char *in, int len); extern void print_ID(strnumber); extern void print_creation_date(); @@ -260,11 +332,11 @@ extern integer colorstackpush(int colstack_no, integer s); extern integer colorstackpop(int colstack_no); extern integer colorstackcurrent(int colstack_no); extern integer colorstackskippagestart(int colstack_no); -extern void checkpdfsave(int cur_h, int cur_v); -extern void checkpdfrestore(int cur_h, int cur_v); +extern void checkpdfsave(scaledpos pos); +extern void checkpdfrestore(scaledpos pos); extern void pdfshipoutbegin(boolean shipping_page); extern void pdfshipoutend(boolean shipping_page); -extern void pdfsetmatrix(poolpointer in, scaled cur_h, scaled cur_v); +extern void pdfsetmatrix(poolpointer in, scaledpos pos); extern void matrixtransformpoint(scaled x, scaled y); extern void matrixtransformrect(scaled llx, scaled lly, scaled urx, scaled ury); extern boolean matrixused(); @@ -274,6 +346,24 @@ extern scaled getlly(); extern scaled geturx(); extern scaled getury(); +/* pdf/pdfpage.c */ +void pdf_place_rule(scaled h, scaled v, scaled wd, scaled ht); +void pdf_place_glyph(internal_font_number f, integer c); +void pdf_place_form(scaled h, scaled v, integer i); +void pdf_goto_pagemode(); +void pdf_page_init(); +void pdf_set_pos(scaled h, scaled v); +void pdf_end_string_nl(); +void pdf_print_charwidth(internal_font_number f, int i); +boolean calc_pdfpos(pdfstructure * p, scaledpos * pos); +void print_pdffloat(pdffloat * f); +void pdf_print_cm(pdffloat * cm); + +/* pdf/pagetree.c */ +extern integer pdf_do_page_divert(integer, integer); +extern void pdf_do_page_undivert(integer, integer); +extern integer output_pages_tree(); + /* writeenc.c */ extern fe_entry *get_fe_entry(char *); extern void enc_free(void); @@ -290,8 +380,7 @@ extern boolean check_image_b(integer); extern boolean check_image_c(integer); extern boolean check_image_i(integer); extern boolean is_pdf_image(integer); -extern integer epdforigx(integer); -extern integer epdforigy(integer); +extern boolean is_png_image(integer); extern integer image_pages(integer); extern integer image_index(integer); extern integer image_width(integer); @@ -306,10 +395,14 @@ extern void img_free(void); extern void update_image_procset(integer); extern void write_image(integer); extern integer image_colordepth(integer img); +extern integer image_groupref(integer img); extern void scale_image(integer); extern void set_image_dimensions(integer, integer, integer, integer); extern void set_image_index(integer, integer); extern void out_image(integer, scaled, scaled); +extern void dumpimagemeta(void); +extern void undumpimagemeta(integer, integer); +extern void pdf_print_resname_prefix(void); /* writejbig2.c */ extern void flush_jbig2_page0_objects(); @@ -373,6 +466,8 @@ typedef enum { typedef struct _lang_variables { int pre_hyphen_char; int post_hyphen_char; + int pre_exhyphen_char; + int post_exhyphen_char; } lang_variables; @@ -384,11 +479,13 @@ struct tex_language { int id; int pre_hyphen_char; int post_hyphen_char; + int pre_exhyphen_char; + int post_exhyphen_char; }; # define MAX_WORD_LEN 256 /* in chars */ -extern struct tex_language *new_language(void); +extern struct tex_language *new_language(int n); extern struct tex_language *get_language(int n); extern void load_patterns(struct tex_language *lang, unsigned char *buf); extern void load_hyphenation(struct tex_language *lang, unsigned char *buf); @@ -405,29 +502,35 @@ extern void set_post_hyphen_char(integer lan, integer val); extern integer get_pre_hyphen_char(integer lan); extern integer get_post_hyphen_char(integer lan); +extern void set_pre_exhyphen_char(integer lan, integer val); +extern void set_post_exhyphen_char(integer lan, integer val); +extern integer get_pre_exhyphen_char(integer lan); +extern integer get_post_exhyphen_char(integer lan); +extern halfword compound_word_break(halfword t, int clang); + extern halfword new_ligkern(halfword head, halfword tail); extern halfword handle_ligaturing(halfword head, halfword tail); extern halfword handle_kerning(halfword head, halfword tail); -# define push_dir(a) \ - { dir_tmp=new_dir((a)); \ - vlink(dir_tmp)=dir_ptr; dir_ptr=dir_tmp; \ - dir_ptr=dir_tmp; \ +# define push_dir(a) \ + { dir_tmp=new_dir((a)); \ + vlink(dir_tmp)=dir_ptr; dir_ptr=dir_tmp; \ + dir_ptr=dir_tmp; \ } -# define push_dir_node(a) \ - { dir_tmp=new_node(whatsit_node,dir_node); \ - dir_dir(dir_tmp)=dir_dir((a)); \ - dir_level(dir_tmp)=dir_level((a)); \ - dir_dvi_h(dir_tmp)=dir_dvi_h((a)); \ - dir_dvi_ptr(dir_tmp)=dir_dvi_ptr((a)); \ - vlink(dir_tmp)=dir_ptr; dir_ptr=dir_tmp; \ +# define push_dir_node(a) \ + { dir_tmp=new_node(whatsit_node,dir_node); \ + dir_dir(dir_tmp)=dir_dir((a)); \ + dir_level(dir_tmp)=dir_level((a)); \ + dir_dvi_h(dir_tmp)=dir_dvi_h((a)); \ + dir_dvi_ptr(dir_tmp)=dir_dvi_ptr((a)); \ + vlink(dir_tmp)=dir_ptr; dir_ptr=dir_tmp; \ } -# define pop_dir_node() \ - { dir_tmp=dir_ptr; \ - dir_ptr=vlink(dir_tmp); \ - flush_node(dir_tmp); \ +# define pop_dir_node() \ + { dir_tmp=dir_ptr; \ + dir_ptr=vlink(dir_tmp); \ + flush_node(dir_tmp); \ } @@ -475,7 +578,8 @@ void ext_do_line_break(boolean d, halfword widow_penalties_ptr, int display_widow_penalty, int widow_penalty, - int broken_penalty, halfword final_par_glue); + int broken_penalty, halfword final_par_glue, + halfword pdf_ignored_dimen); void ext_post_line_break(boolean d, int right_skip, @@ -502,7 +606,8 @@ void ext_post_line_break(boolean d, scaled second_width, scaled second_indent, scaled first_width, - scaled first_indent, halfword best_line); + scaled first_indent, halfword best_line, + halfword pdf_ignored_dimen); halfword lua_hpack_filter(halfword head_node, scaled size, int pack_type, int extrainfo); @@ -510,8 +615,9 @@ void lua_node_filter(int filterid, int extrainfo, halfword head_node, halfword * tail_node); halfword lua_vpack_filter(halfword head_node, scaled size, int pack_type, scaled maxd, int extrainfo); -void lua_node_filter_s(int filterid, char *extrainfo, halfword head_node, - halfword * tail_node); +void lua_node_filter_s(int filterid, char *extrainfo); +int lua_linebreak_callback(int is_broken, halfword head_node, + halfword * new_head); void load_tex_patterns(int curlang, halfword head); void load_tex_hyphenation(int curlang, halfword head); @@ -527,18 +633,61 @@ void set_cat_code(integer h, integer n, halfword v, quarterword gl); halfword get_cat_code(integer h, integer n); void unsave_cat_codes(integer h, quarterword gl); int valid_catcode_table(int h); +void initex_cat_codes(int h); void unsave_text_codes(quarterword grouplevel); void initialize_text_codes(void); void dump_text_codes(void); void undump_text_codes(void); +void copy_cat_codes(int from, int to); +void free_math_codes(void); +void free_text_codes(void); /* mathcodes.c */ -void set_math_code(integer n, halfword v, quarterword gl); -halfword get_math_code(integer n); -void set_del_code(integer n, halfword v, halfword w, quarterword gl); -halfword get_del_code_a(integer n); -halfword get_del_code_b(integer n); +# define no_mathcode 0 /* this is a flag for |scan_delimiter| */ +# define tex_mathcode 8 +# define aleph_mathcode 16 +# define xetex_mathcode 21 +# define xetexnum_mathcode 22 + +typedef struct mathcodeval { + integer class_value; + integer origin_value; + integer family_value; + integer character_value; +} mathcodeval; + +void set_math_code(integer n, + integer commandorigin, + integer mathclass, + integer mathfamily, integer mathcharacter, quarterword gl); + +mathcodeval get_math_code(integer n); +integer get_math_code_num(integer n); +mathcodeval scan_mathchar(int extcode); +mathcodeval scan_delimiter_as_mathchar(int extcode); + +mathcodeval mathchar_from_integer(integer value, int extcode); +void show_mathcode_value(mathcodeval d); + + +typedef struct delcodeval { + integer class_value; + integer origin_value; + integer small_family_value; + integer small_character_value; + integer large_family_value; + integer large_character_value; +} delcodeval; + +void set_del_code(integer n, + integer commandorigin, + integer smathfamily, + integer smathcharacter, + integer lmathfamily, integer lmathcharacter, quarterword gl); + +delcodeval get_del_code(integer n); + void unsave_math_codes(quarterword grouplevel); void initialize_math_codes(void); void dump_math_codes(void); @@ -558,13 +707,10 @@ void undump_luac_registers(void); /* ltexlib.c */ void luacstring_start(int n); void luacstring_close(int n); -int luacstring_detokenized(void); -int luacstring_defaultcattable(void); integer luacstring_cattable(void); -int luacstring_simple(void); -int luacstring_penultimate(void); int luacstring_input(void); - +int luacstring_partial(void); +int luacstring_final_line(void); /* luatoken.c */ void do_get_token_lua(integer callback_id); @@ -574,11 +720,13 @@ int visible_last_node_type(int n); void print_node_mem_stats(int n, int o); /* writeimg.c */ +integer epdf_xsize(integer i); +integer epdf_ysize(integer i); integer epdf_orig_y(integer i); integer epdf_orig_x(integer i); /* limglib.c */ -void lua_setximage(integer i); +void vf_out_image(unsigned i); /* vfovf.c */ void vf_expand_local_fonts(internal_font_number f); @@ -587,29 +735,114 @@ internal_font_number letter_space_font(halfword u, internal_font_number f, internal_font_number auto_expand_font(internal_font_number f, integer e); str_number expand_font_name(internal_font_number f, integer e); void pdf_check_vf_cur_val(void); +internal_font_number copy_font_info(internal_font_number f); /* ltexiolib.c */ void flush_loggable_info(void); /* luastuff.c */ -void closelua(int n); -void luacall(int n, int s); -void luatokencall(int n, int p); +void luacall(int s, int nameptr); +void luatokencall(int p, int nameptr); void tex_error(char *msg, char **hlp); scaled divide_scaled(scaled s, scaled m, integer dd); scaled divide_scaled_n(double s, double m, double d); +/* mlist.c */ +void run_mlist_to_hlist(pointer p, integer m_style, boolean penalties); +void fixup_math_parameters(integer fam_id, integer size_id, integer f, + integer lvl); + /* texpdf.c */ void pdf_print_char(internal_font_number f, integer c); void pdf_print(str_number n); void pdf_print_str(str_number n); -void pdf_print_int(integer n); +void pdf_print_int(longinteger n); +void pdf_print_real(integer m, integer d); /* textoken.c */ +# define NO_CAT_TABLE -2 +# define DEFAULT_CAT_TABLE -1 + +extern boolean str_eq_cstr(str_number, char *, size_t); void get_next(void); +extern void check_outer_validity(void); +boolean scan_keyword(char *); +void scan_direction(void); +halfword active_to_cs(int, int); void get_token_lua(void); +int get_char_cat_code(int); + +/* texdeffont.c */ + +void tex_def_font(small_number a); + +/* lcallbacklib.c */ + +# include <../lua51/lua.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_ocp_file_callback, read_ocp_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_sfd_file_callback, read_sfd_file_callback, + find_pk_file_callback, read_pk_file_callback, + show_error_hook_callback, + process_input_buffer_callback, + start_page_number_callback, stop_page_number_callback, + start_run_callback, stop_run_callback, + define_font_callback, + token_filter_callback, + pre_output_filter_callback, + buildpage_filter_callback, + hpack_filter_callback, vpack_filter_callback, + char_exists_callback, + hyphenate_callback, + ligaturing_callback, + kerning_callback, + pre_linebreak_filter_callback, + linebreak_filter_callback, + post_linebreak_filter_callback, + mlist_to_hlist_callback, + total_callbacks +} callback_callback_types; + +extern int callback_set[]; +extern int lua_active; + +# define callback_defined(a) callback_set[a] + +extern int run_callback(int i, char *values, ...); +extern int run_saved_callback(int i, char *name, char *values, ...); +extern int run_and_save_callback(int i, char *values, ...); +extern void destroy_saved_callback(int i); +extern boolean get_callback(lua_State * L, int i); + +extern void get_saved_lua_boolean(int i, char *name, boolean * target); +extern void get_saved_lua_number(int i, char *name, integer * target); +extern void get_saved_lua_string(int i, char *name, char **target); + +extern void get_lua_boolean(char *table, char *name, boolean * target); +extern void get_lua_number(char *table, char *name, integer * target); +extern void get_lua_string(char *table, char *name, char **target); + +extern char *get_lua_name(int i); + +# include "texmath.h" +# include "primitive.h" #endif /* PDFTEXLIB */ |