diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-09-23 12:35:11 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-09-23 12:35:11 +0000 |
commit | 8b5b4f556944eac343069de79302d0ecc386442c (patch) | |
tree | e96592b152ec51fca993c7dd5e7fbc1871bde75f /Build/source/texk | |
parent | a109e77c63fb849f1bb5f45bca427f4f712c4b15 (diff) |
luatexdir: sync with the upstream
git-svn-id: svn://tug.org/texlive/trunk@42133 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
19 files changed, 314 insertions, 115 deletions
diff --git a/Build/source/texk/web2c/luatexdir/font/texfont.w b/Build/source/texk/web2c/luatexdir/font/texfont.w index e68deac84ad..9b6c0cd6bfe 100644 --- a/Build/source/texk/web2c/luatexdir/font/texfont.w +++ b/Build/source/texk/web2c/luatexdir/font/texfont.w @@ -267,18 +267,25 @@ charinfo *copy_charinfo(charinfo * ci) x = ci->top_left_math_kerns; co->top_left_math_kerns = x; if (x > 0) { - co->top_left_math_kern_array = - xmalloc((unsigned) (2 * (int) sizeof(scaled) * x)); + co->top_left_math_kern_array = xmalloc((unsigned) (2 * (int) sizeof(scaled) * x)); for (k = 0; k < co->top_left_math_kerns; k++) { co->top_left_math_kern_array[(2 * k)] = ci->top_left_math_kern_array[(2 * k)]; co->top_left_math_kern_array[(2 * k) + 1] = ci->top_left_math_kern_array[(2 * k) + 1]; } } + x = ci->bottom_left_math_kerns; + co->bottom_left_math_kerns = x; + if (x > 0) { + co->bottom_left_math_kern_array = xmalloc((unsigned) (2 * (int) sizeof(scaled) * x)); + for (k = 0; k < co->bottom_left_math_kerns; k++) { + co->bottom_left_math_kern_array[(2 * k)] = ci->bottom_left_math_kern_array[(2 * k)]; + co->bottom_left_math_kern_array[(2 * k) + 1] = ci->bottom_left_math_kern_array[(2 * k) + 1]; + } + } x = ci->top_right_math_kerns; co->top_right_math_kerns = x; if (x > 0) { - co->top_right_math_kern_array = - xmalloc((unsigned) (2 * (int) sizeof(scaled) * x)); + co->top_right_math_kern_array = xmalloc((unsigned) (2 * (int) sizeof(scaled) * x)); for (k = 0; k < co->top_right_math_kerns; k++) { co->top_right_math_kern_array[(2 * k)] = ci->top_right_math_kern_array[(2 * k)]; co->top_right_math_kern_array[(2 * k) + 1] = ci->top_right_math_kern_array[(2 * k) + 1]; @@ -287,23 +294,12 @@ charinfo *copy_charinfo(charinfo * ci) x = ci->bottom_right_math_kerns; co->bottom_right_math_kerns = x; if (x > 0) { - co->bottom_right_math_kern_array = - xmalloc((unsigned) (2 * (int) sizeof(scaled) * x)); + co->bottom_right_math_kern_array = xmalloc((unsigned) (2 * (int) sizeof(scaled) * x)); for (k = 0; k < co->bottom_right_math_kerns; k++) { co->bottom_right_math_kern_array[(2 * k)] = ci->bottom_right_math_kern_array[(2 * k)]; co->bottom_right_math_kern_array[(2 * k) + 1] = ci->bottom_right_math_kern_array[(2 * k) + 1]; } } - x = ci->bottom_left_math_kerns; - co->bottom_left_math_kerns = x; - if (x > 0) { - co->bottom_left_math_kern_array = - xmalloc((unsigned) (2 * (int) sizeof(scaled) * x)); - for (k = 0; k < co->bottom_left_math_kerns; k++) { - co->bottom_left_math_kern_array[(2 * k)] = ci->bottom_left_math_kern_array[(2 * k)]; - co->bottom_left_math_kern_array[(2 * k) + 1] = ci->bottom_left_math_kern_array[(2 * k) + 1]; - } - } return co; } @@ -652,10 +648,10 @@ int get_charinfo_math_kerns(charinfo * ci, int id) k = ci->top_left_math_kerns; } else if (id == bottom_left_kern) { k = ci->bottom_left_math_kerns; - } else if (id == bottom_right_kern) { - k = ci->bottom_right_math_kerns; } else if (id == top_right_kern) { k = ci->top_right_math_kerns; + } else if (id == bottom_right_kern) { + k = ci->bottom_right_math_kerns; } else { confusion("get_charinfo_math_kerns"); } @@ -674,25 +670,22 @@ void add_charinfo_math_kern(charinfo * ci, int id, scaled ht, scaled krn) ci->top_left_math_kerns++; } else if (id == bottom_left_kern) { k = ci->bottom_left_math_kerns; - do_realloc(ci->bottom_left_math_kern_array, ((k + 1) * 2), - sizeof(scaled)); + do_realloc(ci->bottom_left_math_kern_array, ((k + 1) * 2), sizeof(scaled)); ci->bottom_left_math_kern_array[(2 * (k))] = ht; ci->bottom_left_math_kern_array[(2 * (k)) + 1] = krn; ci->bottom_left_math_kerns++; - } else if (id == bottom_right_kern) { - k = ci->bottom_right_math_kerns; - do_realloc(ci->bottom_right_math_kern_array, ((k + 1) * 2), - sizeof(scaled)); - ci->bottom_right_math_kern_array[(2 * (k))] = ht; - ci->bottom_right_math_kern_array[(2 * (k)) + 1] = krn; - ci->bottom_right_math_kerns++; } else if (id == top_right_kern) { k = ci->top_right_math_kerns; - do_realloc(ci->top_right_math_kern_array, ((k + 1) * 2), - sizeof(scaled)); + do_realloc(ci->top_right_math_kern_array, ((k + 1) * 2), sizeof(scaled)); ci->top_right_math_kern_array[(2 * (k))] = ht; ci->top_right_math_kern_array[(2 * (k)) + 1] = krn; ci->top_right_math_kerns++; + } else if (id == bottom_right_kern) { + k = ci->bottom_right_math_kerns; + do_realloc(ci->bottom_right_math_kern_array, ((k + 1) * 2), sizeof(scaled)); + ci->bottom_right_math_kern_array[(2 * (k))] = ht; + ci->bottom_right_math_kern_array[(2 * (k)) + 1] = krn; + ci->bottom_right_math_kerns++; } else { confusion("add_charinfo_math_kern"); } @@ -715,17 +708,17 @@ static void dump_math_kerns(charinfo * ci) dump_int(ci->bottom_left_math_kern_array[(2 * k)]); dump_int(ci->bottom_left_math_kern_array[(2 * k) + 1]); } - l = ci->bottom_right_math_kerns; + l = ci->top_right_math_kerns; dump_int(l); for (k = 0; k < l; k++) { - dump_int(ci->bottom_right_math_kern_array[(2 * k)]); - dump_int(ci->bottom_right_math_kern_array[(2 * k) + 1]); + dump_int(ci->top_right_math_kern_array[(2 * k)]); + dump_int(ci->top_right_math_kern_array[(2 * k) + 1]); } - l = ci->top_right_math_kerns; + l = ci->bottom_right_math_kerns; dump_int(l); for (k = 0; k < l; k++) { - dump_int(ci->bottom_left_math_kern_array[(2 * k)]); - dump_int(ci->bottom_left_math_kern_array[(2 * k) + 1]); + dump_int(ci->bottom_right_math_kern_array[(2 * k)]); + dump_int(ci->bottom_right_math_kern_array[(2 * k) + 1]); } } @@ -737,8 +730,7 @@ static void undump_math_kerns(charinfo * ci) undump_int(x); ci->top_left_math_kerns = x; if (x > 0) - ci->top_left_math_kern_array = - xmalloc((unsigned) (2 * (int) sizeof(scaled) * x)); + ci->top_left_math_kern_array = xmalloc((unsigned) (2 * (int) sizeof(scaled) * x)); for (k = 0; k < ci->top_left_math_kerns; k++) { undump_int(x); ci->top_left_math_kern_array[(2 * k)] = (scaled) x; @@ -748,8 +740,7 @@ static void undump_math_kerns(charinfo * ci) undump_int(x); ci->bottom_left_math_kerns = x; if (x > 0) - ci->bottom_left_math_kern_array = - xmalloc((unsigned) (2 * (int) sizeof(scaled) * x)); + ci->bottom_left_math_kern_array = xmalloc((unsigned) (2 * (int) sizeof(scaled) * x)); for (k = 0; k < ci->bottom_left_math_kerns; k++) { undump_int(x); ci->bottom_left_math_kern_array[(2 * k)] = (scaled) x; @@ -757,26 +748,24 @@ static void undump_math_kerns(charinfo * ci) ci->bottom_left_math_kern_array[(2 * k) + 1] = (scaled) x; } undump_int(x); - ci->bottom_right_math_kerns = x; + ci->top_right_math_kerns = x; if (x > 0) - ci->bottom_right_math_kern_array = - xmalloc((unsigned) (2 * (int) sizeof(scaled) * x)); - for (k = 0; k < ci->bottom_right_math_kerns; k++) { + ci->top_right_math_kern_array = xmalloc((unsigned) (2 * (int) sizeof(scaled) * x)); + for (k = 0; k < ci->top_right_math_kerns; k++) { undump_int(x); - ci->bottom_right_math_kern_array[(2 * k)] = (scaled) x; + ci->top_right_math_kern_array[(2 * k)] = (scaled) x; undump_int(x); - ci->bottom_right_math_kern_array[(2 * k) + 1] = (scaled) x; + ci->top_right_math_kern_array[(2 * k) + 1] = (scaled) x; } undump_int(x); - ci->top_right_math_kerns = x; + ci->bottom_right_math_kerns = x; if (x > 0) - ci->top_right_math_kern_array = - xmalloc((unsigned) (2 * (int) sizeof(scaled) * x)); - for (k = 0; k < ci->top_right_math_kerns; k++) { + ci->bottom_right_math_kern_array = xmalloc((unsigned) (2 * (int) sizeof(scaled) * x)); + for (k = 0; k < ci->bottom_right_math_kerns; k++) { undump_int(x); - ci->top_right_math_kern_array[(2 * k)] = (scaled) x; + ci->bottom_right_math_kern_array[(2 * k)] = (scaled) x; undump_int(x); - ci->top_right_math_kern_array[(2 * k) + 1] = (scaled) x; + ci->bottom_right_math_kern_array[(2 * k) + 1] = (scaled) x; } } diff --git a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c index 6bdaca016fd..812ad437b1a 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c @@ -72,6 +72,7 @@ static const char *const callbacknames[] = { "process_rule", "insert_local_par", "contribute_filter", + "call_edit", NULL }; diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c index 3b9846c0ed2..82508a2a9e2 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c @@ -43,6 +43,8 @@ static int luapdfprint(lua_State * L) literal_mode = direct_always; else if (lua_key_eq(modestr_s,page)) literal_mode = direct_page; + else if (lua_key_eq(modestr_s,raw)) + literal_mode = direct_raw; else { luaL_error(L, "invalid first argument for print literal mode"); } @@ -64,6 +66,9 @@ static int luapdfprint(lua_State * L) case (direct_always): pdf_end_string_nl(static_pdf); break; + case (direct_raw): + pdf_end_string_nl(static_pdf); + break; default: assert(0); } @@ -1069,11 +1074,13 @@ static int newpdfcolorstack(lua_State * L) if (lua_type(L,2) == LUA_TSTRING) { l = lua_tostring(L, 2); if (lua_key_eq(l,origin)) { - literal_mode = 0; + literal_mode = set_origin; } else if (lua_key_eq(l,page)) { - literal_mode = 1; /* direct_page */ + literal_mode = direct_page; } else if (lua_key_eq(l,direct)) { - literal_mode = 2; /* direct_always */ + literal_mode = direct_always; + } else if (lua_key_eq(l,raw)) { + literal_mode = direct_raw; } else { luaL_error(L, "invalid literal mode in pdf.newcolorstack()"); } diff --git a/Build/source/texk/web2c/luatexdir/lua/luanode.w b/Build/source/texk/web2c/luatexdir/lua/luanode.w index f901eddbfa9..af15748bacd 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luanode.w +++ b/Build/source/texk/web2c/luatexdir/lua/luanode.w @@ -420,6 +420,9 @@ void show_pdf_literal(pointer p) case direct_always: tprint(" direct"); break; + case direct_raw: + tprint(" raw"); + break; default: confusion("literal2"); break; diff --git a/Build/source/texk/web2c/luatexdir/luatex.c b/Build/source/texk/web2c/luatexdir/luatex.c index 7e06c938885..d2cf856d468 100644 --- a/Build/source/texk/web2c/luatexdir/luatex.c +++ b/Build/source/texk/web2c/luatexdir/luatex.c @@ -28,10 +28,10 @@ #define TeX -int luatex_version = 98; /* \.{\\luatexversion} */ -int luatex_revision = '4'; /* \.{\\luatexrevision} */ -int luatex_date_info = 2016090500; /* the compile date is now hardwired */ -const char *luatex_version_string = "0.98.4"; +int luatex_version = 99; /* \.{\\luatexversion} */ +int luatex_revision = '5'; /* \.{\\luatexrevision} */ +int luatex_date_info = 2016092300; /* the compile date is now hardwired */ +const char *luatex_version_string = "0.99.5"; const char *engine_name = my_name; /* the name of this engine */ #include <kpathsea/c-ctype.h> @@ -61,10 +61,6 @@ const char *engine_name = my_name; /* the name of this engine */ #include <signal.h> /* Catch interrupts. */ -/* {tex,mf}d.h defines TeX, MF, INI, and other such symbols. - Unfortunately there's no way to get the banner into this code, so - just repeat the text. */ -#define edit_var "TEXEDIT" /* Shell escape. diff --git a/Build/source/texk/web2c/luatexdir/luatexcallbackids.h b/Build/source/texk/web2c/luatexdir/luatexcallbackids.h index 4a02f05d058..cfd865b896a 100644 --- a/Build/source/texk/web2c/luatexdir/luatexcallbackids.h +++ b/Build/source/texk/web2c/luatexdir/luatexcallbackids.h @@ -66,6 +66,7 @@ typedef enum { process_rule_callback, insert_local_par_callback, contribute_filter_callback, + call_edit_callback, total_callbacks } callback_callback_types; diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.h b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.h index 551f686e6fe..f2086663c70 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.h @@ -27,8 +27,8 @@ # define PROCSET_IMAGE_C (1 << 3) # define PROCSET_IMAGE_I (1 << 4) -# define inf_pdf_mem_size 10000 /* min size of the |mem| array */ -# define sup_pdf_mem_size 10000000 /* max size of the |mem| array */ +# define inf_pdf_mem_size 10000 /* min size of the |mem| array */ +# define sup_pdf_mem_size 100000000 /* max size of the |mem| array */ extern PDF static_pdf; @@ -43,10 +43,10 @@ be the first written bytes. */ -# define inf_pdfout_buf_size 16384 /* initial value of |pdf->buf| size */ -# define sup_pdfout_buf_size 16384 /* arbitrary upper hard limit of |pdf->buf| size */ -# define inf_objstm_buf_size 1 /* initial value of |os->buf[OBJSTM_BUF]| size */ -# define sup_objstm_buf_size 5000000 /* arbitrary upper hard limit of |os->buf[OBJSTM_BUF]| size */ +# define inf_pdfout_buf_size 16384 /* initial value of |pdf->buf| size */ +# define sup_pdfout_buf_size 8*16384 /* arbitrary upper hard limit of |pdf->buf| size */ +# define inf_objstm_buf_size 1 /* initial value of |os->buf[OBJSTM_BUF]| size */ +# define sup_objstm_buf_size 5000000 /* arbitrary upper hard limit of |os->buf[OBJSTM_BUF]| size */ # define PDF_OS_MAX_OBJS 100 /* maximum number of objects in object stream */ diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w b/Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w index 3c6b6f6efbf..64a36dc67bf 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w @@ -66,6 +66,9 @@ void pdf_out_literal(PDF pdf, halfword p) pdf_end_string_nl(pdf); ps->need_tm = true; break; + case direct_raw: + pdf_end_string_nl(pdf); + break; default: normal_error("pdf backend","bad literal mode"); break; @@ -114,6 +117,9 @@ void pdf_literal(PDF pdf, str_number s, int literal_mode, boolean warn) } else if (str_in_cstr(s, "page:", strlen("PDF:"))) { j = j + (pool_pointer) strlen("page:"); literal_mode = direct_page; + } else if (str_in_cstr(s, "raw:", strlen("PDF:"))) { + j = j + (pool_pointer) strlen("raw:"); + literal_mode = direct_raw; } else { literal_mode = set_origin; } @@ -131,6 +137,9 @@ void pdf_literal(PDF pdf, str_number s, int literal_mode, boolean warn) pdf_end_string_nl(pdf); p->need_tm = true; break; + case direct_raw: + pdf_end_string_nl(pdf); + break; default: normal_error("pdf backend","bad literal mode"); break; diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfrule.w b/Build/source/texk/web2c/luatexdir/pdf/pdfrule.w index 2f75b4c761e..df4979088c8 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfrule.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfrule.w @@ -30,14 +30,22 @@ void pdf_place_rule(PDF pdf, halfword q, scaledpos size, int callback_id) pdfpos dim; pdfstructure *p = pdf->pstruct; scaledpos pos = pdf->posstruct->pos; + halfword s = subtype(q); /* (void) q; */ - if (subtype(q) == box_rule) { + if (s >= math_over_rule && s <= math_radical_rule) { + if (callback_id == 0) { + s = normal_rule; + } else { + s = user_rule; + } + } + if (s == box_rule) { pdf_place_form(pdf,q); - } else if (subtype(q) == image_rule) { + } else if (s == image_rule) { pdf_place_image(pdf,q); - } else if (subtype(q) == empty_rule) { + } else if (s == empty_rule) { /* place nothing, only take space */ - } else if (subtype(q) == user_rule) { + } else if (s == user_rule) { if (callback_id != 0) { pdf_goto_pagemode(pdf); pdf_puts(pdf, "q\n"); diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.w b/Build/source/texk/web2c/luatexdir/tex/commands.w index e4a269d93d0..b89dadffd1f 100644 --- a/Build/source/texk/web2c/luatexdir/tex/commands.w +++ b/Build/source/texk/web2c/luatexdir/tex/commands.w @@ -754,6 +754,8 @@ void initialize_etex_commands(void) primitive_luatex("mathdisplayskipmode", assign_int_cmd, int_base + math_display_skip_mode_code, int_base); primitive_luatex("mathscriptsmode", assign_int_cmd, int_base + math_scripts_mode_code, int_base); primitive_luatex("mathnolimitsmode", assign_int_cmd, int_base + math_nolimits_mode_code, int_base); + primitive_luatex("mathrulesmode", assign_int_cmd, int_base + math_rules_mode_code, int_base); + primitive_luatex("mathrulesfam", assign_int_cmd, int_base + math_rules_fam_code, int_base); primitive_luatex("synctex", assign_int_cmd, int_base + synctex_code, int_base); primitive_etex("currentgrouplevel", last_item_cmd, current_group_level_code, 0); diff --git a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w index 85ff55f4e09..c7bb4c2e87d 100644 --- a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w +++ b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w @@ -23,7 +23,7 @@ /* we start with 907: the sum of the values of the bytes of "don knuth" */ -#define FORMAT_ID (907+18) +#define FORMAT_ID (907+20) #if ((FORMAT_ID>=0) && (FORMAT_ID<=256)) #error Wrong value for FORMAT_ID. #endif diff --git a/Build/source/texk/web2c/luatexdir/tex/equivalents.h b/Build/source/texk/web2c/luatexdir/tex/equivalents.h index b2bda5f605b..27a4f96401b 100644 --- a/Build/source/texk/web2c/luatexdir/tex/equivalents.h +++ b/Build/source/texk/web2c/luatexdir/tex/equivalents.h @@ -279,20 +279,22 @@ the |number_regs| \.{\\dimen} registers. # define math_display_skip_mode_code 88 # define math_scripts_mode_code 89 # define math_nolimits_mode_code 90 -# define synctex_code 91 /* is synctex file generation enabled ? */ -# define shape_mode_code 92 -# define first_valid_language_code 93 -# define hyphenation_bounds_code 94 +# define math_rules_mode_code 91 +# define math_rules_fam_code 92 +# define synctex_code 93 /* is synctex file generation enabled ? */ +# define shape_mode_code 94 +# define first_valid_language_code 95 +# define hyphenation_bounds_code 96 -# define math_option_code 95 +# define math_option_code 97 -# define mathoption_int_base (int_base+96) /* one reserve */ -# define mathoption_int_last (int_base+104) +# define mathoption_int_base (int_base+98) /* one reserve */ +# define mathoption_int_last (int_base+106) -# define backend_int_base (int_base+105) -# define backend_int_last (int_base+129) +# define backend_int_base (int_base+107) +# define backend_int_last (int_base+131) -# define tex_int_pars (130) /* total number of integer parameters */ +# define tex_int_pars (132) /* total number of integer parameters */ # define page_direction_code (tex_int_pars) # define body_direction_code (tex_int_pars+1) @@ -639,6 +641,8 @@ extern halfword last_cs_name; #define disable_space_par int_par(disable_space_code) #define scripts_mode_par int_par(math_scripts_mode_code) #define nolimits_mode_par int_par(math_nolimits_mode_code) +#define math_rules_mode_par int_par(math_rules_mode_code) +#define math_rules_fam_par int_par(math_rules_fam_code) #define thin_mu_skip_par glue_par(thin_mu_skip_code) #define med_mu_skip_par glue_par(med_mu_skip_code) diff --git a/Build/source/texk/web2c/luatexdir/tex/errors.w b/Build/source/texk/web2c/luatexdir/tex/errors.w index 1af16ec58ef..cec9a144f1c 100644 --- a/Build/source/texk/web2c/luatexdir/tex/errors.w +++ b/Build/source/texk/web2c/luatexdir/tex/errors.w @@ -24,6 +24,7 @@ luafflib.c @ @c #include "ptexlib.h" +#define edit_var "TEXEDIT" @ When something anomalous is detected, \TeX\ typically does something like this: $$\vbox{\halign{#\hfil\cr @@ -232,6 +233,155 @@ void jump_out(void) close_files_and_terminate(); do_final_end(); } +@ Here is the function that calls the editor, if one is defined. This +is loosely based on a similar function in kpathsea, but the calling +convention is quite different. + +@c +static const_string edit_value = EDITOR; + +#if defined(WIN32) +static int +Isspace (char c) +{ + return (c == ' ' || c == '\t'); +} +#endif /* WIN32 */ + +__attribute__ ((noreturn)) +static void luatex_calledit (int baseptr, int linenumber) +{ + char *temp, *command, *fullcmd; + char c; + int sdone, ddone, i; + char *filename = makecstring(input_stack[base_ptr].name_field); + int fnlength = strlen(filename); + +#ifdef WIN32 + char *fp, *ffp, *env, editorname[256], buffer[256]; + int cnt = 0; + int dontchange = 0; +#endif + + sdone = ddone = 0; + + /* Close any open input files, since we're going to kill the job. */ + close_files_and_terminate(); + + /* Replace the default with the value of the appropriate environment + variable or config file value, if it's set. */ + temp = kpse_var_value (edit_var); + if (temp != NULL) + edit_value = temp; + + /* Construct the command string. The `11' is the maximum length an + integer might be. */ + command = xmalloc (strlen (edit_value) + fnlength + 11); + + /* So we can construct it as we go. */ + temp = command; + +#ifdef WIN32 + fp = editorname; + if ((isalpha(*edit_value) && *(edit_value + 1) == ':' + && IS_DIR_SEP (*(edit_value + 2))) + || (*edit_value == '"' && isalpha(*(edit_value + 1)) + && *(edit_value + 2) == ':' + && IS_DIR_SEP (*(edit_value + 3))) + ) + dontchange = 1; +#endif + + while ((c = *edit_value++) != 0) + { + if (c == '%') + { + switch (c = *edit_value++) + { + case 'd': + if (ddone) + FATAL1 ("call_edit: `%%d' appears twice in editor command: `%s'", edit_value); + sprintf (temp, "%ld", (long int)linenumber); + while (*temp != '\0') + temp++; + ddone = 1; + break; + + case 's': + if (sdone) + FATAL1 ("call_edit: `%%s' appears twice in editor command: `%s'", edit_value); + for (i =0; i < fnlength; i++) + *temp++ = filename[i]; + sdone = 1; + break; + + case '\0': + *temp++ = '%'; + /* Back up to the null to force termination. */ + edit_value--; + break; + + default: + *temp++ = '%'; + *temp++ = c; + break; + } + } + else { +#ifdef WIN32 + if (dontchange) + *temp++ = c; + else { if(Isspace(c) && cnt == 0) { + cnt++; + temp = command; + *temp++ = c; + *fp = '\0'; + } else if(!Isspace(c) && cnt == 0) { + *fp++ = c; + } else { + *temp++ = c; + } + } +#else + *temp++ = c; +#endif + } + } + + *temp = 0; + +#ifdef WIN32 + if (dontchange == 0) { + if(editorname[0] == '.' || + editorname[0] == '/' || + editorname[0] == '\\') { + fprintf(stderr, "%s is not allowed to execute.\n", editorname); + do_final_end(); + } + env = (char *)getenv("PATH"); + if(SearchPath(env, editorname, ".exe", 256, buffer, &ffp)==0) { + if(SearchPath(env, editorname, ".bat", 256, buffer, &ffp)==0) { + fprintf(stderr, "I cannot find %s in the PATH.\n", editorname); + do_final_end(); + } + } + fullcmd = (char *)xmalloc(strlen(buffer)+strlen(command)+5); + strcpy(fullcmd, "\""); + strcat(fullcmd, buffer); + strcat(fullcmd, "\""); + strcat(fullcmd, command); + } else +#endif + fullcmd = command; + + /* Execute the command. */ + if (system (fullcmd) != 0) + fprintf (stderr, "! Trouble executing `%s'.\n", command); + + /* Quit, since we found an error. */ + do_final_end (); +} + @ @c void error(void) @@ -325,12 +475,23 @@ void error(void) #endif case 'E': if (base_ptr > 0) { - tprint_nl("You want to edit file "); - print(input_stack[base_ptr].name_field); - tprint(" at line "); - print_int(line); - interaction = scroll_mode; - jump_out(); + int callback_id = callback_defined(call_edit_callback); + if (callback_id>0) { + (void)run_callback(callback_id, "Sd->", makecstring(input_stack[base_ptr].name_field), line); + jump_out(); /* should not be reached */ + } else { + tprint_nl("You want to edit file "); + print(input_stack[base_ptr].name_field); + tprint(" at line "); + print_int(line); + interaction = scroll_mode; + if (kpse_init) { + luatex_calledit(base_ptr, line); + } else { + tprint_nl("There is no valid callback defined."); + jump_out(); /* should not be reached */ + } + } } break; case 'H': diff --git a/Build/source/texk/web2c/luatexdir/tex/extensions.w b/Build/source/texk/web2c/luatexdir/tex/extensions.w index 838c6edcead..f3c66d32ed2 100644 --- a/Build/source/texk/web2c/luatexdir/tex/extensions.w +++ b/Build/source/texk/web2c/luatexdir/tex/extensions.w @@ -142,6 +142,8 @@ static void do_extension_pdf(int immediate) set_pdf_literal_mode(tail, direct_always); else if (scan_keyword("page")) set_pdf_literal_mode(tail, direct_page); + else if (scan_keyword("raw")) + set_pdf_literal_mode(tail, direct_raw); else set_pdf_literal_mode(tail, set_origin); scan_toks(false, true); diff --git a/Build/source/texk/web2c/luatexdir/tex/mlist.w b/Build/source/texk/web2c/luatexdir/tex/mlist.w index 753ce840cbc..909128e93c6 100644 --- a/Build/source/texk/web2c/luatexdir/tex/mlist.w +++ b/Build/source/texk/web2c/luatexdir/tex/mlist.w @@ -271,7 +271,7 @@ static scaled minimum_operator_size(int var) the backward compatibility code, and it means that we can't raise an error here. @c -static scaled radical_rule(int var) +static scaled radical_rule_par(int var) { scaled a = get_math_param(math_param_radical_rule, var); return a; @@ -978,10 +978,16 @@ static pointer math_clone(pointer q) that eventually contains it. @c -static pointer do_fraction_rule(scaled t, pointer att) +static pointer do_fraction_rule(scaled t, pointer att, halfword some_rule, halfword cur_size, halfword cur_fam) { pointer p; /* the new node */ - p = new_rule(normal_rule); + if (math_rules_mode_par) { + p = new_rule(some_rule); + rule_math_size(p) = cur_size; + rule_math_font(p) = fam_fnt(cur_fam, cur_size); + } else { + p = new_rule(normal_rule); + } rule_dir(p) = math_direction_par; height(p) = t; depth(p) = 0; @@ -994,13 +1000,13 @@ static pointer do_fraction_rule(scaled t, pointer att) fraction rule of thickness |t| under additional space of height |ht|. @c -static pointer overbar(pointer b, scaled k, scaled t, scaled ht, pointer att) +static pointer overbar(pointer b, scaled k, scaled t, scaled ht, pointer att, halfword index, halfword cur_size, halfword cur_fam) { pointer p, q; /* nodes being constructed */ p = new_kern(k); reset_attributes(p, att); couple_nodes(p,b); - q = do_fraction_rule(t, att); + q = do_fraction_rule(t, att, index, cur_size, cur_fam); couple_nodes(q,p); p = new_kern(ht); reset_attributes(p, att); @@ -1796,17 +1802,17 @@ illustrate the general setup of such procedures, let's begin with a couple of simple ones. @c -static void make_over(pointer q, int cur_style) +static void make_over(pointer q, int cur_style, int cur_size, int cur_fam) { pointer p; p = overbar(clean_box(nucleus(q), cramped_style(cur_style), cur_style), overbar_vgap(cur_style), overbar_rule(cur_style), - overbar_kern(cur_style), node_attr(nucleus(q))); + overbar_kern(cur_style), node_attr(nucleus(q)), math_over_rule, cur_size, cur_fam); math_list(nucleus(q)) = p; type(nucleus(q)) = sub_box_node; } -static void make_under(pointer q, int cur_style) +static void make_under(pointer q, int cur_style, int cur_size, int cur_fam) { pointer p, x, y, r; /* temporary registers for box construction */ scaled delta; /* overall height plus depth */ @@ -1814,7 +1820,7 @@ static void make_under(pointer q, int cur_style) p = new_kern(underbar_vgap(cur_style)); reset_attributes(p, node_attr(q)); couple_nodes(x,p); - r = do_fraction_rule(underbar_rule(cur_style), node_attr(q)); + r = do_fraction_rule(underbar_rule(cur_style), node_attr(q), math_under_rule, cur_size, cur_fam); couple_nodes(p,r); y = vpackage(x, 0, additional, max_dimen, math_direction_par); reset_attributes(y, node_attr(q)); @@ -1878,7 +1884,7 @@ static void make_radical(pointer q, int cur_style) scaled delta, clr, theta, h; /* dimensions involved in the calculation */ x = clean_box(nucleus(q), cramped_style(cur_style), cur_style); clr = radical_vgap(cur_style); - theta = radical_rule(cur_style); + theta = radical_rule_par(cur_style); if (theta == undefined_math_parameter) { /* a real radical */ theta = fraction_rule(cur_style); @@ -1912,7 +1918,7 @@ static void make_radical(pointer q, int cur_style) } shift_amount(y) = (height(y) - theta) - (height(x) + clr); h = depth(y) + height(y); - p = overbar(x, clr, theta, radical_kern(cur_style), node_attr(y)); + p = overbar(x, clr, theta, radical_kern(cur_style), node_attr(y), math_radical_rule, cur_size, small_fam(left_delimiter(q))); couple_nodes(y,p); if (degree(q) != null) { scaled wr, br, ar; @@ -2559,7 +2565,7 @@ static void make_fraction(pointer q, int cur_style) p = new_kern((shift_up - depth(x)) - (height(z) - shift_down)); couple_nodes(p,z); } else { - y = do_fraction_rule(thickness(q), node_attr(q)); + y = do_fraction_rule(thickness(q), node_attr(q), math_fraction_rule, cur_size, math_rules_fam_par); p = new_kern((math_axis_size(cur_size) - delta) - (height(z) - shift_down)); reset_attributes(p, node_attr(q)); couple_nodes(y,p); @@ -2656,8 +2662,9 @@ static scaled make_op(pointer q, int cur_style) math_character(nucleus(q)) = c; } delta = char_italic(cur_f, cur_c); +printf("delta %i\n",delta); x = clean_box(nucleus(q), cur_style, cur_style); - if (delta != null) { + if (delta != 0) { if (do_new_math(cur_f)) { /* we never added italic correction */ } else if ((subscr(q) != null) && (subtype(q) != op_noad_type_limits)) { @@ -2712,8 +2719,8 @@ static scaled make_op(pointer q, int cur_style) */ switch (mode) { case 0 : - /* as with limits */ - make_scripts(q, p, 0, cur_style, half(delta), -half(delta)); + /* full bottom correction */ + make_scripts(q, p, 0, cur_style, 0, -delta); break; case 1 : /* MathConstants driven */ @@ -2723,22 +2730,21 @@ static scaled make_op(pointer q, int cur_style) case 2 : /* no correction */ make_scripts(q, p, 0, cur_style, 0, 0); - break; + break ; case 3 : /* half bottom correction */ make_scripts(q, p, 0, cur_style, 0, -half(delta)); break; case 4 : - /* full bottom correction */ - make_scripts(q, p, 0, cur_style, 0, -delta); + /* half bottom and top correction */ + make_scripts(q, p, 0, cur_style, half(delta), -half(delta)); break; default : - /* half bottom and top correction */ if (mode > 15) { /* for quickly testing values */ make_scripts(q, p, 0, cur_style, 0, -round_xn_over_d(delta, mode, 1000)); } else { - make_scripts(q, p, 0, cur_style, half(delta), -half(delta)); + make_scripts(q, p, 0, cur_style, 0, 0); } break; } @@ -3913,10 +3919,10 @@ void mlist_to_hlist(pointer mlist, boolean penalties, int cur_style) } break; case over_noad_type: - make_over(q, cur_style); + make_over(q, cur_style, cur_size, math_rules_fam_par); break; case under_noad_type: - make_under(q, cur_style); + make_under(q, cur_style, cur_size, math_rules_fam_par); break; case vcenter_noad_type: make_vcenter(q); diff --git a/Build/source/texk/web2c/luatexdir/tex/texfileio.w b/Build/source/texk/web2c/luatexdir/tex/texfileio.w index c222eef975b..2281de12c4c 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texfileio.w +++ b/Build/source/texk/web2c/luatexdir/tex/texfileio.w @@ -170,12 +170,12 @@ char *luatex_find_file(const char *s, int callback_index) case find_data_file_callback: ftemp = find_in_output_directory(s); if (!ftemp) - ftemp = kpse_find_file(s, kpse_tex_format, 0); + ftemp = kpse_find_file(s, kpse_tex_format, 1); break; case find_font_file_callback: - ftemp = kpse_find_file(s, kpse_ofm_format, 0); + ftemp = kpse_find_file(s, kpse_ofm_format, 1); if (ftemp == NULL) - ftemp = kpse_find_file(s, kpse_tfm_format, 0); + ftemp = kpse_find_file(s, kpse_tfm_format, 1); break; case find_vf_file_callback: ftemp = kpse_find_file(s, kpse_ovf_format, 0); diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.h b/Build/source/texk/web2c/luatexdir/tex/texnodes.h index 6650d17f410..943a347554d 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texnodes.h +++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.h @@ -261,6 +261,10 @@ typedef enum { image_rule, empty_rule, user_rule, + math_over_rule, + math_under_rule, + math_fraction_rule, + math_radical_rule, } rule_subtypes; # define rule_node_size 8 @@ -270,6 +274,9 @@ typedef enum { # define synctex_tag_rule(a) vinfo((a)+7) # define synctex_line_rule(a) vlink((a)+7) +# define rule_math_size rule_index +# define rule_math_font rule_transform + # define mark_node_size 3 # define mark_ptr(a) vlink((a)+2) # define mark_class(a) vinfo((a)+2) @@ -716,6 +723,7 @@ typedef enum { set_origin = 0, direct_page, direct_always, + direct_raw, scan_special, } ctm_transform_modes; diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.w b/Build/source/texk/web2c/luatexdir/tex/texnodes.w index c242577404f..3a368c82336 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texnodes.w +++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.w @@ -268,7 +268,7 @@ const char *node_subtypes_kern[] = { "fontkern", "userkern", "accentkern", "italiccorrection", NULL }; const char *node_subtypes_rule[] = { - "normal", "box", "image", "empty", "user", NULL + "normal", "box", "image", "empty", "user", "over", "under", "fraction", "radical", NULL }; const char *node_subtypes_glyph[] = { "character", "glyph", "ligature", "ghost", "left", "right", NULL diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.w b/Build/source/texk/web2c/luatexdir/tex/textoken.w index 8f44f686641..7b781fc082b 100644 --- a/Build/source/texk/web2c/luatexdir/tex/textoken.w +++ b/Build/source/texk/web2c/luatexdir/tex/textoken.w @@ -2437,6 +2437,8 @@ static int do_feedback_pdf(halfword c) cur_val = direct_always; else if (scan_keyword("page")) cur_val = direct_page; + else if (scan_keyword("raw")) + cur_val = direct_raw; else cur_val = set_origin; save_scanner_status = scanner_status; |