texlive[60425] Build/source/texk/web2c/mplibdir: mplibdir: sync with
commits+kakuto at tug.org
commits+kakuto at tug.org
Sun Sep 5 02:08:16 CEST 2021
Revision: 60425
http://tug.org/svn/texlive?view=revision&revision=60425
Author: kakuto
Date: 2021-09-05 02:08:16 +0200 (Sun, 05 Sep 2021)
Log Message:
-----------
mplibdir: sync with the upstream
Modified Paths:
--------------
trunk/Build/source/texk/web2c/mplibdir/lmplib.c
trunk/Build/source/texk/web2c/mplibdir/mp.w
trunk/Build/source/texk/web2c/mplibdir/mpxout.w
Modified: trunk/Build/source/texk/web2c/mplibdir/lmplib.c
===================================================================
--- trunk/Build/source/texk/web2c/mplibdir/lmplib.c 2021-09-04 23:48:53 UTC (rev 60424)
+++ trunk/Build/source/texk/web2c/mplibdir/lmplib.c 2021-09-05 00:08:16 UTC (rev 60425)
@@ -405,7 +405,7 @@
return 0;
}
-static char *mplib_run_script(MP mp, const char *str)
+static char *mplib_run_script(MP mp, const char *str, size_t len)
{
lua_State *L = (lua_State *)mp_userdata(mp);
lua_checkstack(L, 1);
@@ -413,7 +413,7 @@
if (lua_isfunction(L, -1)) {
char *s = NULL;
const char *x = NULL;
- lua_pushstring(L, str);
+ lua_pushlstring(L, str, len);
if (lua_pcall(L, 1, 1, 0) != 0) {
fprintf(stdout,"mplib warning: error in script: %s\n",lua_tostring(L, -1));
return NULL;
@@ -441,7 +441,7 @@
return 0;
}
-static char *mplib_make_text(MP mp, const char *str, int mode)
+static char *mplib_make_text(MP mp, const char *str, size_t len, int mode)
{
lua_State *L = (lua_State *)mp_userdata(mp);
lua_checkstack(L, 1);
@@ -449,7 +449,7 @@
if (lua_isfunction(L, -1)) {
char *s = NULL;
const char *x = NULL;
- lua_pushstring(L, str);
+ lua_pushlstring(L, str, len);
lua_pushinteger(L, mode);
if (lua_pcall(L, 2, 1, 0) != 0) {
mplib_script_error(mp, lua_tostring(L, -1));
@@ -1869,7 +1869,7 @@
static void mplib_text(lua_State * L, struct mp_text_object *h)
{
if (FIELD(text)) {
- lua_pushstring(L, h->text_p);
+ lua_pushlstring(L, h->text_p, h->text_l);
} else if (FIELD(dsize)) {
mplib_push_number(L, (h->font_dsize / 16));
} else if (FIELD(font)) {
Modified: trunk/Build/source/texk/web2c/mplibdir/mp.w
===================================================================
--- trunk/Build/source/texk/web2c/mplibdir/mp.w 2021-09-04 23:48:53 UTC (rev 60424)
+++ trunk/Build/source/texk/web2c/mplibdir/mp.w 2021-09-05 00:08:16 UTC (rev 60425)
@@ -922,8 +922,8 @@
mp_filetype_text /* first text file for readfrom and writeto primitives */
};
typedef char *(*mp_file_finder) (MP, const char *, const char *, int);
-typedef char *(*mp_script_runner) (MP, const char *);
-typedef char *(*mp_text_maker) (MP, const char *, int mode);
+typedef char *(*mp_script_runner) (MP, const char *, size_t);
+typedef char *(*mp_text_maker) (MP, const char *, size_t, int);
typedef void *(*mp_file_opener) (MP, const char *, const char *, int);
typedef char *(*mp_file_reader) (MP, void *, size_t *);
typedef void (*mp_binfile_reader) (MP, void *, void **, size_t *);
@@ -960,15 +960,15 @@
}
@ @c
-static char *mp_run_script (MP mp, const char *str) {
+static char *mp_run_script (MP mp, const char *str, size_t len) {
(void) mp;
- return mp_strdup (str);
+ return mp_strldup (str, len);
}
@ @c
-static char *mp_make_text (MP mp, const char *str, int mode) {
+static char *mp_make_text (MP mp, const char *str, size_t len, int mode) {
(void) mp;
- return mp_strdup (str);
+ return mp_strldup (str, len);
}
@ Because |mp_find_file| is used so early, it has to be in the helpers
@@ -975,10 +975,8 @@
section.
@<Declarations@>=
-static char *mp_find_file (MP mp, const char *fname, const char *fmode,
- int ftype);
-static void *mp_open_file (MP mp, const char *fname, const char *fmode,
- int ftype);
+static char *mp_find_file (MP mp, const char *fname, const char *fmode, int ftype);
+static void *mp_open_file (MP mp, const char *fname, const char *fmode, int ftype);
static char *mp_read_ascii_file (MP mp, void *f, size_t * size);
static void mp_read_binary_file (MP mp, void *f, void **d, size_t * size);
static void mp_close_file (MP mp, void *f);
@@ -986,8 +984,8 @@
static void mp_flush_file (MP mp, void *f);
static void mp_write_ascii_file (MP mp, void *f, const char *s);
static void mp_write_binary_file (MP mp, void *f, void *s, size_t t);
-static char *mp_run_script (MP mp, const char *str);
-static char *mp_make_text (MP mp, const char *str, int mode);
+static char *mp_run_script (MP mp, const char *str, size_t len);
+static char *mp_make_text (MP mp, const char *str, size_t len, int mode);
@ The function to open files can now be very short.
@@ -15855,7 +15853,7 @@
set_number_from_scaled (mp->cur_tt, 1);
goto NOT_FOUND;
}
-
+
if (number_to_scaled (mp->delx) - mp->tol <=
number_to_scaled (stack_max (x_packet (mp->xy))) - number_to_scaled (stack_min (u_packet (mp->uv))))
if (number_to_scaled (mp->delx) + mp->tol >=
@@ -18136,7 +18134,7 @@
@d push_input { /* enter a new input level, save the old */
if ( mp->input_ptr>mp->max_in_stack ) {
mp->max_in_stack=mp->input_ptr;
- if ( mp->input_ptr==mp->stack_size ) {
+ if ( mp->input_ptr==mp->stack_size ) {
int l = (mp->stack_size+(mp->stack_size/4));
/* The mp->stack_size < 1001 condition is necessary to prevent C stack overflow due infinite recursion. */
if (l>1000) {fprintf(stderr, "input stack overflow\n");exit(EXIT_FAILURE);}
@@ -20004,7 +20002,7 @@
} else {
mp_back_input (mp);
if (cur_exp_str ()->len > 0) {
- char *s = mp->run_script(mp,(const char*) cur_exp_str()->str) ;
+ char *s = mp->run_script(mp,(const char*) cur_exp_str()->str, cur_exp_str()->len) ;
@<Run a script@>
free(s);
}
@@ -20150,7 +20148,7 @@
}
/* action */
{
- char *s = mp->make_text(mp,ptr,verb) ;
+ char *s = mp->make_text(mp,ptr,size,verb) ;
@<Run a script@>
free(s);
}
@@ -20201,7 +20199,7 @@
} else {
mp_back_input (mp);
if (cur_exp_str ()->len > 0) {
- char *s = mp->make_text(mp,(const char*) cur_exp_str()->str,0) ;
+ char *s = mp->make_text(mp,(const char*) cur_exp_str()->str,cur_exp_str()->len,0) ;
@<Run a script@>
free(s);
}
Modified: trunk/Build/source/texk/web2c/mplibdir/mpxout.w
===================================================================
--- trunk/Build/source/texk/web2c/mplibdir/mpxout.w 2021-09-04 23:48:53 UTC (rev 60424)
+++ trunk/Build/source/texk/web2c/mplibdir/mpxout.w 2021-09-05 00:08:16 UTC (rev 60425)
@@ -3869,7 +3869,7 @@
char *wrk, *p;
#ifdef _WIN32
struct _finddata_t c_file;
- long hFile;
+ intptr_t hFile;
#else
struct dirent *entry;
DIR *d;
More information about the tex-live-commits
mailing list.