diff options
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lua')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/lfontlib.c | 13 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/llanglib.c | 3 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/llualib.c | 12 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/lmplib.c | 60 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/lpdflib.c | 121 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/ltexlib.c | 48 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/luatoken.c | 10 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/mp.w | 79 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/psout.w | 23 |
9 files changed, 233 insertions, 136 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua/lfontlib.c b/Build/source/texk/web2c/luatexdir/lua/lfontlib.c index 13632527082..4bb5252daa7 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lfontlib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lfontlib.c @@ -1,4 +1,4 @@ -/* $Id: lfontlib.c 1013 2008-02-14 00:09:02Z oneiros $ */ +/* $Id: lfontlib.c 1171 2008-04-16 13:56:53Z taco $ */ #include "luatex-api.h" #include <ptexlib.h> @@ -181,6 +181,16 @@ deffont (lua_State *L) { return 0; /* not reached */ } +/* this returns the expected (!) next fontid. */ +static int +nextfontid (lua_State *L) { + int i = new_font(); + lua_pushnumber(L,i); + delete_font(i); + return 1; +} + + static int getfont (lua_State *L) { int i; @@ -201,6 +211,7 @@ static const struct luaL_reg fontlib [] = { {"getfont", getfont}, {"setfont", setfont}, {"define", deffont}, + {"nextid", nextfontid}, {"frozen", frozenfont}, {NULL, NULL} /* sentinel */ }; diff --git a/Build/source/texk/web2c/luatexdir/lua/llanglib.c b/Build/source/texk/web2c/luatexdir/lua/llanglib.c index 63e8c45dec8..a5227afa1a0 100644 --- a/Build/source/texk/web2c/luatexdir/lua/llanglib.c +++ b/Build/source/texk/web2c/luatexdir/lua/llanglib.c @@ -29,6 +29,9 @@ This is llanglib.c #define check_islang(L,b) (struct tex_language **)luaL_checkudata(L,b,LANG_METATABLE) +extern halfword *check_isnode (lua_State *L, int ud) ; + + static int lang_new (lua_State *L) { struct tex_language **lang; diff --git a/Build/source/texk/web2c/luatexdir/lua/llualib.c b/Build/source/texk/web2c/luatexdir/lua/llualib.c index 0d13500a9b7..90b1687f3b1 100644 --- a/Build/source/texk/web2c/luatexdir/lua/llualib.c +++ b/Build/source/texk/web2c/luatexdir/lua/llualib.c @@ -1,5 +1,5 @@ -/* $Id: llualib.c 1013 2008-02-14 00:09:02Z oneiros $ */ +/* $Id: llualib.c 1169 2008-04-15 14:57:56Z oneiros $ */ #include "luatex-api.h" #include <ptexlib.h> @@ -49,17 +49,17 @@ void undump_luac_registers (void) { if (luabytecode_max>=0) { i = (luabytecode_max+1); if ((int)(UINT_MAX32/sizeof(bytecode)+1)<=i) { - lua_fatal_error("Corrupt format file"); + lua_fatal_error(maketexstring("Corrupt format file")); } lua_bytecode_registers = xmalloc(i*sizeof(bytecode)); luabytecode_bytes = i*sizeof(bytecode); - for (i=0;i<=luabytecode_max;i++) { + for (i=0;i<=(unsigned)luabytecode_max;i++) { lua_bytecode_registers[i].done = 0; lua_bytecode_registers[i].size = 0; lua_bytecode_registers[i].buf = NULL; } undump_int(n); - for (i=0;i<n;i++) { + for (i=0;i<(unsigned)n;i++) { undump_int(k); undump_int(b.size); b.buf=xmalloc(b.size); @@ -107,7 +107,7 @@ bytecode_register_shadow_get (lua_State* L, int k){ int writer(lua_State* L, const void* b, size_t size, void* B) { bytecode* buf = (bytecode*)B; - if (buf->size + size > buf->alloc) { + if ((int)(buf->size + size) > buf->alloc) { buf->buf = xrealloc(buf->buf,buf->alloc+size+LOAD_BUF_SIZE); buf->alloc = buf->alloc+size+LOAD_BUF_SIZE; } @@ -176,7 +176,7 @@ int set_bytecode (lua_State *L) { } else { luabytecode_bytes += sizeof(bytecode)*(k+1-luabytecode_max); } - for (i=(luabytecode_max+1);i<=k;i++) { + for (i=(luabytecode_max+1);i<=(unsigned)k;i++) { lua_bytecode_registers[i].buf=NULL; lua_bytecode_registers[i].size=0; lua_bytecode_registers[i].done=0; diff --git a/Build/source/texk/web2c/luatexdir/lua/lmplib.c b/Build/source/texk/web2c/luatexdir/lua/lmplib.c index a194f9a55d8..b435618e97b 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lmplib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lmplib.c @@ -430,7 +430,7 @@ void mplib_write_ascii_file (MP mp, void *ff, const char *s) { } else if (f==mplib_data->ps_file_ptr) { APPEND_STRING(ps_out,s); } else { - fprintf((FILE *)f,s); + fprintf((FILE *)f,"%s",s); } } } @@ -883,8 +883,7 @@ mplib_gr_tostring (lua_State *L) { static int mplib_gr_fields (lua_State *L) { const char **fields; - const char *f; - int i = 1; + int i ; struct mp_graphic_object **hh = is_gr_object(L,1); if (*hh) { switch ((*hh)->_type_field) { @@ -899,9 +898,9 @@ mplib_gr_fields (lua_State *L) { default: fields = no_fields; } lua_newtable(L); - for (f = *fields; f != NULL; f++) { - lua_pushstring(L,f); - lua_rawseti(L,-2,i); i++; + for (i=0;fields[i]!=NULL;i++) { + lua_pushstring(L,fields[i]); + lua_rawseti(L,-2,(i+1)); } } else { lua_pushnil(L); @@ -926,16 +925,16 @@ mplib_push_path (lua_State *L, struct mp_knot *h, int is_pen) { lua_createtable(L,0,6); if (!is_pen) { if (p->left_type_field != mp_explicit) { - mplib_push_S(left_type); - lua_pushstring(L,knot_type_enum[p->left_type_field]); - lua_rawset(L,-3); - } - if (p->right_type_field != mp_explicit) { - mplib_push_S(right_type); - lua_pushstring(L,knot_type_enum[p->right_type_field]); - lua_rawset(L,-3); - } - } + mplib_push_S(left_type); + lua_pushstring(L,knot_type_enum[p->left_type_field]); + lua_rawset(L,-3); + } + if (p->right_type_field != mp_explicit) { + mplib_push_S(right_type); + lua_pushstring(L,knot_type_enum[p->right_type_field]); + lua_rawset(L,-3); + } + } mplib_push_S(x_coord); mplib_push_number(L,p->x_coord_field); lua_rawset(L,-3); @@ -965,6 +964,23 @@ mplib_push_path (lua_State *L, struct mp_knot *h, int is_pen) { } } +/* this assumes that the top of the stack is a table + or nil already in the case + */ +static void +mplib_push_pentype (lua_State *L, struct mp_knot *h) { + struct mp_knot *p; /* for scanning the path */ + p=h; + if (p==NULL) { + /* do nothing */ + } else if (p==p->next_field) { + mplib_push_S(type); + lua_pushstring(L,"elliptical"); + lua_rawset(L,-3); + } else { + } +} + #define set_color_objects(pq) \ object_color_model = pq->color_model_field; \ object_color_a = pq->color_field._a_val; \ @@ -1012,6 +1028,7 @@ mplib_push_color (lua_State *L, struct mp_graphic_object *p ) { static void mplib_push_dash (lua_State *L, struct mp_stroked_object *h ) { mp_dash_object *d; + double ds; if (h!=NULL && h->dash_p_field != NULL) { d = h->dash_p_field; lua_newtable(L); @@ -1021,7 +1038,8 @@ mplib_push_dash (lua_State *L, struct mp_stroked_object *h ) { int i = 0; lua_newtable(L); while (*(d->array_field+i) != -1) { - mplib_push_number(L, *(d->array_field+1)); + ds = *(d->array_field+1) / 65536.0; + lua_pushnumber(L, ds); i++; lua_rawseti(L,-2,i); } @@ -1064,6 +1082,7 @@ mplib_fill_field (lua_State *L, struct mp_fill_object *h) { mplib_push_path(L, h->htap_p_field, MPLIB_PATH); } else if (FIELD(pen)) { mplib_push_path(L, h->pen_p_field, MPLIB_PEN); + mplib_push_pentype(L, h->pen_p_field); } else if (FIELD(color)) { mplib_push_color(L,(mp_graphic_object *)h); } else if (FIELD(linejoin)) { @@ -1085,6 +1104,7 @@ mplib_stroked_field (lua_State *L, struct mp_stroked_object *h) { mplib_push_path(L, h->path_p_field, MPLIB_PATH); } else if (FIELD(pen)) { mplib_push_path(L, h->pen_p_field, MPLIB_PEN); + mplib_push_pentype(L, h->pen_p_field); } else if (FIELD(color)) { mplib_push_color(L, (mp_graphic_object *)h); } else if (FIELD(dash)) { @@ -1163,6 +1183,7 @@ mplib_gr_index (lua_State *L) { struct mp_graphic_object **hh = is_gr_object(L,1); if (*hh) { struct mp_graphic_object *h = *hh; + if (mplib_is_S(type,2)) { lua_rawgeti(L,LUA_REGISTRYINDEX,mplib_type_Ses[h->_type_field]); } else { @@ -1206,7 +1227,6 @@ static const struct luaL_reg mplib_gr_meta[] = { {"__gc", mplib_gr_collect }, {"__tostring", mplib_gr_tostring }, {"__index", mplib_gr_index }, - {"fields", mplib_gr_fields }, {NULL, NULL} /* sentinel */ }; @@ -1220,7 +1240,8 @@ static const struct luaL_reg mplib_d [] = { static const struct luaL_reg mplib_m[] = { - {"new", mplib_new}, + {"new", mplib_new }, + {"fields", mplib_gr_fields }, {NULL, NULL} /* sentinel */ }; @@ -1228,6 +1249,7 @@ static const struct luaL_reg mplib_m[] = { int luaopen_mp (lua_State *L) { mplib_init_Ses(L); + luaL_newmetatable(L,MPLIB_GR_METATABLE); lua_pushvalue(L, -1); /* push metatable */ lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c index 9cf847c84c8..393409b0729 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c @@ -1,23 +1,23 @@ -/* $Id: lpdflib.c 1013 2008-02-14 00:09:02Z oneiros $ */ +/* $Id: lpdflib.c 1154 2008-04-13 22:36:03Z oneiros $ */ #include "luatex-api.h" #include <ptexlib.h> -static int -findcurv (lua_State *L) { - int j; - j = get_cur_v(); - lua_pushnumber(L, j); - return 1; +static int findcurv(lua_State * L) +{ + int j; + j = get_cur_v(); + lua_pushnumber(L, j); + return 1; } -static int -findcurh (lua_State *L) { - int j; - j = get_cur_h(); - lua_pushnumber(L, j); - return 1; +static int findcurh(lua_State * L) +{ + int j; + j = get_cur_h(); + lua_pushnumber(L, j); + return 1; } @@ -26,7 +26,8 @@ typedef enum { set_origin, direct_page, direct_always } pdf_lit_mode; int luapdfprint(lua_State * L) { int n; - unsigned i, len; + unsigned i; + size_t len; const char *outputstr, *st; pdf_lit_mode literal_mode; n = lua_gettop(L); @@ -46,13 +47,12 @@ int luapdfprint(lua_State * L) else if (strcmp(outputstr, "page") == 0) literal_mode = direct_page; else { - lua_pushstring(L, - "invalid argument for print literal mode"); + lua_pushstring(L, "invalid argument for print literal mode"); lua_error(L); } } } else { - if (n != 1) { + if (n != 1) { lua_pushstring(L, "invalid number of arguments"); lua_error(L); } @@ -71,57 +71,72 @@ int luapdfprint(lua_State * L) default: assert(0); } - st = lua_tolstring(L, n,&len); + st = lua_tolstring(L, n, &len); for (i = 0; i < len; i++) { - if (i%16 == 0) - pdfroom(16); - pdf_buf[pdf_ptr++] = st[i]; + if (i % 16 == 0) + pdfroom(16); + pdf_buf[pdf_ptr++] = st[i]; } return 0; } -static int -getpdf (lua_State *L) { - char *st; - if (lua_isstring(L,2)) { - st = (char *)lua_tostring(L,2); - if (st && *st) { - if (*st == 'h') - return findcurh(L); - else if (*st == 'v') - return findcurv(L); +#define obj_type_others 0 + +static int l_immediateobj(lua_State * L) +{ + if (!lua_isstring(L, -1)) + luaL_error(L, "pdf.immediateobj needs string value"); + pdf_create_obj(obj_type_others, 0); + pdf_begin_obj(obj_ptr, 1); + pdf_printf("%s\n", lua_tostring(L, -1)); + pdf_end_obj(); + lua_pop(L, 1); + lua_pushinteger(L, obj_ptr); + return 1; +} + +static int getpdf(lua_State * L) +{ + char *st; + if (lua_isstring(L, 2)) { + st = (char *) lua_tostring(L, 2); + if (st && *st) { + if (*st == 'h') + return findcurh(L); + else if (*st == 'v') + return findcurv(L); + } } - } - lua_pushnil(L); - return 1; + lua_pushnil(L); + return 1; } -static int -setpdf (lua_State *L) { - return (L==NULL ? 0 : 0); /* for -Wall */ +static int setpdf(lua_State * L) +{ + return (L == NULL ? 0 : 0); /* for -Wall */ } static const struct luaL_reg pdflib[] = { {"print", luapdfprint}, + {"immediateobj", l_immediateobj}, {NULL, NULL} /* sentinel */ }; -int -luaopen_pdf (lua_State *L) { - luaL_register(L, "pdf", pdflib); - /* build meta table */ - luaL_newmetatable(L,"pdf_meta"); - lua_pushstring(L, "__index"); - lua_pushcfunction(L, getpdf); - /* do these later, NYI */ - if (0) { +int luaopen_pdf(lua_State * L) +{ + luaL_register(L, "pdf", pdflib); + /* build meta table */ + luaL_newmetatable(L, "pdf_meta"); + lua_pushstring(L, "__index"); + lua_pushcfunction(L, getpdf); + /* do these later, NYI */ + if (0) { + lua_settable(L, -3); + lua_pushstring(L, "__newindex"); + lua_pushcfunction(L, setpdf); + } lua_settable(L, -3); - lua_pushstring(L, "__newindex"); - lua_pushcfunction(L, setpdf); - } - lua_settable(L, -3); - lua_setmetatable(L,-2); /* meta to itself */ - return 1; + lua_setmetatable(L, -2); /* meta to itself */ + return 1; } - diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c index f2258010136..937c802727a 100644 --- a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c +++ b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c @@ -1,4 +1,4 @@ -/* $Id: ltexlib.c 1087 2008-03-07 23:52:35Z hhenkel $ */ +/* $Id: ltexlib.c 1168 2008-04-15 13:43:34Z taco $ */ #include "luatex-api.h" #include <ptexlib.h> @@ -135,6 +135,8 @@ luacstring_input (void) { last = first; ret = last; check_buffer_overflow (last + t->tsize); + /* make sure it fits in the pool as well (for show_token_list c.s) */ + check_pool_overflow(pool_ptr + t->tsize); while (t->tsize-->0) buffer[last++] = *st++; if (!t->partial) { @@ -193,7 +195,7 @@ luacstring_close (int n) { #define height_offset 3 #define check_index_range(j) \ - if (j<0 || j > 65535) { \ + if (j > 65535) { \ lua_pushstring(L, "incorrect index value"); \ lua_error(L); } @@ -449,9 +451,38 @@ int gettoks (lua_State *L) { return 1; } +/* UGLY hack */ + +#define char_given 70 +#define math_given 71 +#define omath_given 72 + +static int get_box_id (lua_State *L, int i) { + const char *s; + integer cur_cs, cur_cmd; + str_number texstr; + size_t k = 0; + int j = -1; + if (lua_type(L,i)==LUA_TSTRING) { + s = (char *)lua_tolstring(L,i, &k); + texstr = maketexlstring(s,k); + cur_cs = string_lookup(texstr); + cur_cmd = zget_eq_type(cur_cs); + flush_str(texstr); + if (cur_cmd==char_given || + cur_cmd==math_given || + cur_cmd==omath_given) { + j = zget_equiv(cur_cs); + } + } else { + j = (int)lua_tonumber(L,(i)); + } + return j; +} + int getbox (lua_State *L) { int k, t; - k = (int)luaL_checkinteger(L,-1); + k = get_box_id(L,-1); check_index_range(k); t = get_tex_box_register(k); nodelist_to_lua(L,t); @@ -460,10 +491,7 @@ int getbox (lua_State *L) { int setbox (lua_State *L) { int i,j,k; - - - - k = (int)luaL_checkinteger(L,-2); + k = get_box_id(L,-2); check_index_range(k); i = get_tex_box_register(k); if (lua_isboolean(L,-1)) { @@ -482,11 +510,10 @@ int setbox (lua_State *L) { return 0; } - static int getboxdim (lua_State *L, int whichdim) { int i, j; i = lua_gettop(L); - j = (int)lua_tonumber(L,(i)); + j = get_box_id(L,i); lua_settop(L,(i-2)); /* table at -1 */ if (j<0 || j > 65535) { lua_pushstring(L, "incorrect index"); @@ -525,7 +552,7 @@ static int setboxdim (lua_State *L, int whichdim) { } else { j = (int)lua_tonumber(L,i); } - k = (int)lua_tonumber(L,(i-1)); + k = get_box_id(L,(i-1)); lua_settop(L,(i-3)); /* table at -2 */ if (k<0 || k > 65535) { lua_pushstring(L, "incorrect index"); @@ -704,6 +731,7 @@ getlist (lua_State *L) { int setlist (lua_State *L) { + assert(L); return 0; } diff --git a/Build/source/texk/web2c/luatexdir/lua/luatoken.c b/Build/source/texk/web2c/luatexdir/lua/luatoken.c index 23d9ca82150..bf434b286bb 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luatoken.c +++ b/Build/source/texk/web2c/luatexdir/lua/luatoken.c @@ -1,4 +1,4 @@ -/* $Id: luatoken.c 1013 2008-02-14 00:09:02Z oneiros $ */ +/* $Id: luatoken.c 1168 2008-04-15 13:43:34Z taco $ */ #include "luatex-api.h" #include <ptexlib.h> @@ -222,7 +222,7 @@ get_cur_cs (lua_State *L) { if (lua_isstring(L,-1)) { s = (char *)lua_tolstring(L,-1,&l); if (l>0) { - if (last+l>buf_size) + if ((int)(last+l)>buf_size) check_buffer_overflow(last+l); for (j=0;j<l;j++) { buffer[last+1+j]=*s++; @@ -330,7 +330,7 @@ tokenlist_to_cstring ( int p , int inhibit_par, int *siz) { Print_uchar(q-active_base); } } - } else if ((q>=undefined_control_sequence)&&((q<=eqtb_size))||(q>eqtb_size+hash_extra)) { + } else if ((q>=undefined_control_sequence)&&((q<=eqtb_size)||(q>eqtb_size+hash_extra))) { Print_esc("IMPOSSIBLE."); } else if ((zget_cs_text(q)<0)||(zget_cs_text(q)>=str_ptr)) { Print_esc("NONEXISTENT."); @@ -439,8 +439,8 @@ tokenlist_to_luastring(lua_State *L, int p) { int tokenlist_from_lua(lua_State *L) { char *s; - int tok,i; - size_t j; + int tok; + size_t i,j; halfword p,q,r; r = get_avail(); info(r)=0; /* ref count */ diff --git a/Build/source/texk/web2c/luatexdir/lua/mp.w b/Build/source/texk/web2c/luatexdir/lua/mp.w index a459cc48fe1..4894a54e9aa 100644 --- a/Build/source/texk/web2c/luatexdir/lua/mp.w +++ b/Build/source/texk/web2c/luatexdir/lua/mp.w @@ -75,8 +75,8 @@ undergoes any modifications, so that it will be clear which version of @d banner "This is MetaPost, Version 1.003" /* printed when \MP\ starts */ @d metapost_version "1.003" -@d mplib_version "0.30" -@d version_string " (Cweb version 0.30)" +@d mplib_version "0.40" +@d version_string " (Cweb version 0.40)" @d true 1 @d false 0 @@ -659,6 +659,8 @@ char *mp_read_ascii_file (MP mp, void *ff, size_t *size) { FILE *f = (FILE *)ff; *size = 0; (void) mp; /* for -Wunused */ + if (f==NULL) + return NULL; #if NOTTESTING c = fgetc(f); if (c==EOF) @@ -700,7 +702,8 @@ void mp_read_binary_file (MP mp, void *f, void **data, size_t *size) { size_t len = 0; (void) mp; #if NOTTESTING - len = fread(*data,1,*size,(FILE *)f); + if (f!=NULL) + len = fread(*data,1,*size,(FILE *)f); #endif *size = len; } @@ -719,7 +722,8 @@ void mp_write_binary_file (MP mp, void *f, void *s, size_t size) { void mp_close_file (MP mp, void *f) { (void) mp; #if NOTTESTING - fclose((FILE *)f); + if (f!=NULL) + fclose((FILE *)f); #endif } @@ -727,7 +731,10 @@ void mp_close_file (MP mp, void *f) { int mp_eof_file (MP mp, void *f) { (void) mp; #if NOTTESTING - return feof((FILE *)f); + if (f!=NULL) + return feof((FILE *)f); + else + return 1; #else return 0; #endif @@ -737,7 +744,8 @@ int mp_eof_file (MP mp, void *f) { void mp_flush_file (MP mp, void *f) { (void) mp; #if NOTTESTING - fflush((FILE *)f); + if (f!=NULL) + fflush((FILE *)f); #endif } @@ -9517,27 +9525,39 @@ dash_y(hh)=dash_y(h) @ |h| is an edge structure @c -mp_dash_object *mp_export_dashes (MP mp, pointer h) { +mp_dash_object *mp_export_dashes (MP mp, pointer q, scaled *w) { mp_dash_object *d; - pointer p; + pointer p, h; + scaled scf; /* scale factor */ scaled *dashes = NULL; int num_dashes = 1; + h = dash_p(q); if (h==null || dash_list(h)==null_dash) return NULL; p = dash_list(h); + scf=mp_get_pen_scale(mp, pen_p(q)); + if (scf==0) { + if (*w==0) scf = dash_scale(q); else return NULL; + } else { + scf=mp_make_scaled(mp, *w,scf); + scf=mp_take_scaled(mp, scf,dash_scale(q)); + } + *w = scf; d = mp_xmalloc(mp,1,sizeof(mp_dash_object)); start_x(null_dash)=start_x(p)+dash_y(h); while (p != null_dash) { dashes = mp_xrealloc(mp, dashes, num_dashes+2, sizeof(scaled)); - dashes[(num_dashes-1)] = (stop_x(p)-start_x(p)); - dashes[(num_dashes)] = (start_x(link(p))-stop_x(p)); + dashes[(num_dashes-1)] = + mp_take_scaled(mp,(stop_x(p)-start_x(p)),scf); + dashes[(num_dashes)] = + mp_take_scaled(mp,(start_x(link(p))-stop_x(p)),scf); dashes[(num_dashes+1)] = -1; /* terminus */ num_dashes+=2; p=link(p); } d->array_field = dashes; - d->offset_field = mp_dash_offset(mp, h); - d->scale_field = dash_scale(h); + d->offset_field = + mp_take_scaled(mp,mp_dash_offset(mp, h),scf); return d; } @@ -9590,8 +9610,6 @@ pointer mp_copy_objects (MP mp, pointer p, pointer q) { } @ @<Fix anything in graphical object |pp| that should differ from the...@>= -if ( pre_script(p)!=null ) add_str_ref(pre_script(p)); -if ( post_script(p)!=null ) add_str_ref(post_script(p)); switch (type(p)) { case mp_start_clip_code: case mp_start_bounds_code: @@ -9599,14 +9617,20 @@ case mp_start_bounds_code: break; case mp_fill_code: path_p(pp)=mp_copy_path(mp, path_p(p)); + if ( pre_script(p)!=null ) add_str_ref(pre_script(p)); + if ( post_script(p)!=null ) add_str_ref(post_script(p)); if ( pen_p(p)!=null ) pen_p(pp)=copy_pen(pen_p(p)); break; case mp_stroked_code: + if ( pre_script(p)!=null ) add_str_ref(pre_script(p)); + if ( post_script(p)!=null ) add_str_ref(post_script(p)); path_p(pp)=mp_copy_path(mp, path_p(p)); pen_p(pp)=copy_pen(pen_p(p)); if ( dash_p(p)!=null ) add_edge_ref(dash_p(pp)); break; case mp_text_code: + if ( pre_script(p)!=null ) add_str_ref(pre_script(p)); + if ( post_script(p)!=null ) add_str_ref(post_script(p)); add_str_ref(text_p(pp)); break; case mp_stop_clip_code: @@ -10376,7 +10400,7 @@ integer spec_offset; /* number of pen edges between |h| and the initial offset * @ @c @<Declare subroutines needed by |offset_prep|@> pointer mp_offset_prep (MP mp,pointer c, pointer h) { halfword n; /* the number of vertices in the pen polygon */ - pointer p,q,q0,r,w, ww; /* for list manipulation */ + pointer c0,p,q,q0,r,w, ww; /* for list manipulation */ integer k_needed; /* amount to be added to |info(p)| when it is computed */ pointer w0; /* a pointer to pen offset to use just before |p| */ scaled dxin,dyin; /* the direction into knot |p| */ @@ -10385,7 +10409,7 @@ pointer mp_offset_prep (MP mp,pointer c, pointer h) { dx0=0; dy0=0; @<Initialize the pen size~|n|@>; @<Initialize the incoming direction and pen offset at |c|@>; - p=c; k_needed=0; + p=c; c0=c; k_needed=0; do { q=link(p); @<Split the cubic between |p| and |q|, if necessary, into cubics @@ -10456,7 +10480,7 @@ do { p=r; } while (p!=q); /* Check if we removed too much */ -if(q!=q0) +if ((q!=q0)&&(q!=c||c==c0)) q = link(q) @ @<Remove the cubic following |p| and update the data structures...@>= @@ -23247,7 +23271,6 @@ void mp_do_write (MP mp) ; @ @<Record the end of file on |wr_file[n]|@>= { (mp->close_file)(mp,mp->wr_file[n]); xfree(mp->wr_fname[n]); - mp->wr_fname[n]=NULL; if ( n==mp->write_files-1 ) mp->write_files=n; } @@ -25218,6 +25241,7 @@ void mp_ship_out (MP mp, pointer h) ; struct mp_edge_object *mp_gr_export(MP mp, pointer h) { pointer p; /* the current graphical object */ integer t; /* a temporary value */ + scaled d_width; /* the current pen width */ mp_edge_object *hh; /* the first graphical object */ struct mp_graphic_object *hq; /* something |hp| points to */ struct mp_text_object *tt; @@ -25244,6 +25268,7 @@ struct mp_edge_object *mp_gr_export(MP mp, pointer h) { case mp_fill_code: tf = (mp_fill_object *)hq; gr_pen_p(tf) = mp_export_knot_list(mp,pen_p(p)); + d_width = mp_get_pen_scale(mp, pen_p(p)); if ((pen_p(p)==null) || pen_is_elliptical(pen_p(p))) { gr_path_p(tf) = mp_export_knot_list(mp,path_p(p)); } else { @@ -25265,6 +25290,7 @@ struct mp_edge_object *mp_gr_export(MP mp, pointer h) { case mp_stroked_code: ts = (mp_stroked_object *)hq; gr_pen_p(ts) = mp_export_knot_list(mp,pen_p(p)); + d_width = mp_get_pen_scale(mp, pen_p(p)); if (pen_is_elliptical(pen_p(p))) { gr_path_p(ts) = mp_export_knot_list(mp,path_p(p)); } else { @@ -25286,7 +25312,7 @@ struct mp_edge_object *mp_gr_export(MP mp, pointer h) { gr_ljoin_val(ts) = ljoin_val(p); gr_miterlim_val(ts) = miterlim_val(p); gr_lcap_val(ts) = lcap_val(p); - gr_dash_p(ts) = mp_export_dashes(mp,dash_p(p)); + gr_dash_p(ts) = mp_export_dashes(mp,p,&d_width); break; case mp_text_code: tt = (mp_text_object *)hq; @@ -25666,6 +25692,7 @@ for (k=p;k<=mp->lo_mem_max;k++ ) undump_wd(mp->mem[k]); undump(mp->lo_mem_max+1,hi_mem_stat_min,mp->hi_mem_min); undump(null,mp->mem_top,mp->avail); mp->mem_end=mp->mem_top; +mp->last_pending=spec_head; for (k=mp->hi_mem_min;k<= mp->mem_end;k++) undump_wd(mp->mem[k]); undump_int(mp->var_used); undump_int(mp->dyn_used) @@ -25841,6 +25868,7 @@ if (mp->rd_fname!=NULL) { for (k=0;k<=(int)mp->read_files-1;k++ ) { if ( mp->rd_fname[k]!=NULL ) { (mp->close_file)(mp,mp->rd_file[k]); + xfree(mp->rd_fname[k]); } } } @@ -25848,6 +25876,7 @@ if (mp->wr_fname!=NULL) { for (k=0;k<=(int)mp->write_files-1;k++) { if ( mp->wr_fname[k]!=NULL ) { (mp->close_file)(mp,mp->wr_file[k]); + xfree(mp->wr_fname[k]); } } } @@ -25856,19 +25885,19 @@ if (mp->wr_fname!=NULL) { for (k=0;k<(int)mp->max_read_files;k++ ) { if ( mp->rd_fname[k]!=NULL ) { (mp->close_file)(mp,mp->rd_file[k]); - mp_xfree(mp->rd_fname[k]); + xfree(mp->rd_fname[k]); } } -mp_xfree(mp->rd_file); -mp_xfree(mp->rd_fname); +xfree(mp->rd_file); +xfree(mp->rd_fname); for (k=0;k<(int)mp->max_write_files;k++) { if ( mp->wr_fname[k]!=NULL ) { (mp->close_file)(mp,mp->wr_file[k]); - mp_xfree(mp->wr_fname[k]); + xfree(mp->wr_fname[k]); } } -mp_xfree(mp->wr_file); -mp_xfree(mp->wr_fname); +xfree(mp->wr_file); +xfree(mp->wr_fname); @ We want to produce a \.{TFM} file if and only if |mp_fontmaking| is positive. diff --git a/Build/source/texk/web2c/luatexdir/lua/psout.w b/Build/source/texk/web2c/luatexdir/lua/psout.w index 4a3f588ef7f..90cf6923e01 100644 --- a/Build/source/texk/web2c/luatexdir/lua/psout.w +++ b/Build/source/texk/web2c/luatexdir/lua/psout.w @@ -4405,12 +4405,9 @@ format, it is closely modelled to the PostScript model. The array of dashes is ended by a single negative value, because this is not allowed in PostScript. -@d gr_dash_scale(A) (gr_dash_p(A))->scale_field - @<Types...@>= typedef struct { scaled offset_field; - scaled scale_field; scaled *array_field; } mp_dash_object ; @@ -4707,7 +4704,6 @@ void mp_gr_fix_graphics_state (MP mp, mp_graphic_object *p) { scaled wx,wy,ww; /* dimensions of pen bounding box */ boolean adj_wx; /* whether pixel rounding should be based on |wx| or |wy| */ integer tx,ty; /* temporaries for computing |adj_wx| */ - scaled scf; /* a scale factor for the dash pattern */ if ( gr_has_color(p) ) @<Make sure \ps\ will use the right color for object~|p|@>; if ( (gr_type(p)==mp_fill_code)||(gr_type(p)==mp_stroked_code) ) { @@ -4980,13 +4976,6 @@ if ( gr_type(p)==mp_fill_code || gr_dash_p(p) == NULL) { hh=NULL; } else { hh=gr_dash_p(p); - scf=mp_gr_get_pen_scale(mp, gr_pen_p((mp_fill_object *)p)); - if ( scf==0 ) { - if ( gs_width==0 ) scf=hh->scale_field; else hh=NULL; - } else { - scf=mp_make_scaled(mp, gs_width,scf); - scf=mp_take_scaled(mp, scf, (hh == NULL ? unity : gr_dash_scale(p))); - } } if ( hh==NULL ) { if ( gs_dash_p!=NULL || gs_dash_init_done == false) { @@ -5038,9 +5027,6 @@ boolean mp_gr_same_dashes (mp_dash_object *h, mp_dash_object *hh) ; @ This function test if |h| and |hh| represent the same dash pattern. -The |scale_field| is ignored in this test because it is not really -a property of the PostScript format of a dash pattern. - @c boolean mp_gr_same_dashes (mp_dash_object *h, mp_dash_object *hh) { boolean ret=false; @@ -5496,9 +5482,12 @@ void mp_gr_ship_out (mp_edge_object *hh, int prologues, int procset) { case mp_start_bounds_code: case mp_stop_bounds_code: break; - case mp_special_code: - mp_ps_print_nl (mp, gr_pre_script((mp_special_object *)p)); - mp_ps_print_ln (mp); + case mp_special_code: + { + mp_special_object *ps = (mp_special_object *)p; + mp_ps_print_nl (mp, gr_pre_script(ps)); + mp_ps_print_ln (mp); + } break; } /* all cases are enumerated */ p=gr_link(p); |