summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/mplibdir
diff options
context:
space:
mode:
authorLuigi Scarso <luigi.scarso@gmail.com>2019-07-08 06:07:11 +0000
committerLuigi Scarso <luigi.scarso@gmail.com>2019-07-08 06:07:11 +0000
commitf93b62903a20648ab4328443b88495da81f70909 (patch)
tree6a870996cc04dca9a1ae3dbbc334b4c2a1385711 /Build/source/texk/web2c/mplibdir
parent54d39e16610eee4dde770b0a6b569203c79abde8 (diff)
sync with luatex rev.7174: luatex and luahbtex and jit variants
git-svn-id: svn://tug.org/texlive/trunk@51577 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/mplibdir')
-rw-r--r--Build/source/texk/web2c/mplibdir/ChangeLog7
-rw-r--r--Build/source/texk/web2c/mplibdir/lmplib.c6
-rw-r--r--Build/source/texk/web2c/mplibdir/mp.w38
3 files changed, 44 insertions, 7 deletions
diff --git a/Build/source/texk/web2c/mplibdir/ChangeLog b/Build/source/texk/web2c/mplibdir/ChangeLog
index 61360ed6739..b6f1945f17a 100644
--- a/Build/source/texk/web2c/mplibdir/ChangeLog
+++ b/Build/source/texk/web2c/mplibdir/ChangeLog
@@ -1,11 +1,14 @@
2019-03-06 Luigi Scarso <luigi.scarso@gmail.com>
- * Code clean-up.
+ * Code clean-up.
+
+
+2019-02-06: Taco Hoekwater <taco@elvenkind.com>
+ * New primitive void: convert a suffix to a boolean. Work in progress.
2019-01-28 Andreas Scherer <https://ascherer.github.io>
* mpost.w: TeXnical nitpicking.
-
2019-01-26 Luigi Scarso <luigi.scarso@gmail.com>
* Fixed bisection algorithm (overflow of number of bisections in decimal mode with low precision)
* Added 2 levels to the bisection algorithm for cubic intersection. Need testing.
diff --git a/Build/source/texk/web2c/mplibdir/lmplib.c b/Build/source/texk/web2c/mplibdir/lmplib.c
index eb8432bb507..59b747c66dd 100644
--- a/Build/source/texk/web2c/mplibdir/lmplib.c
+++ b/Build/source/texk/web2c/mplibdir/lmplib.c
@@ -294,6 +294,7 @@ typedef enum {
P_MAKE_TEXT,
P_SCRIPT_ERROR,
P_EXTENSIONS,
+ P_UTF8_MODE,
P__SENTINEL
} mplib_parm_idx;
@@ -316,6 +317,7 @@ static mplib_parm_struct mplib_parms[] = {
{"script_error", P_SCRIPT_ERROR },
{"extensions", P_EXTENSIONS },
{"math_mode", P_MATH_MODE },
+ {"utf8_mode", P_UTF8_MODE },
{NULL, P__SENTINEL }
};
@@ -544,6 +546,7 @@ static int mplib_new(lua_State * L)
/* options->script_error = mplib_script_error; */
options->print_found_names = 1;
options->ini_version = 1;
+ options->utf8_mode = 0;
if (lua_type(L, 1) == LUA_TTABLE) {
for (i = 0; mplib_parms[i].name != NULL; i++) {
lua_getfield(L, 1, mplib_parms[i].name);
@@ -600,6 +603,9 @@ static int mplib_new(lua_State * L)
case P_EXTENSIONS:
options->extensions = (int)lua_tointeger(L, -1);
break;
+ case P_UTF8_MODE:
+ options->utf8_mode = (int)lua_toboolean(L, -1);
+ break;
default:
break;
}
diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w
index 682fb4e53fc..d7a284335b5 100644
--- a/Build/source/texk/web2c/mplibdir/mp.w
+++ b/Build/source/texk/web2c/mplibdir/mp.w
@@ -742,6 +742,7 @@ int max_print_line; /* width of longest text lines output; should be at leas
void *userdata; /* this allows the calling application to setup local */
char *banner; /* the banner that is printed to the screen and log */
int ini_version;
+int utf8_mode;
@ @<Dealloc variables@>=
xfree (mp->banner);
@@ -761,6 +762,7 @@ mp->max_print_line = 100;
set_lower_limited_value (mp->max_print_line, opt->max_print_line, 79);
mp->halt_on_error = (opt->halt_on_error ? true : false);
mp->ini_version = (opt->ini_version ? true : false);
+mp->utf8_mode = (opt->utf8_mode ? true : false);
@ In case somebody has inadvertently made bad settings of the ``constants,''
\MP\ checks them using a global variable called |bad|.
@@ -1665,7 +1667,7 @@ The user might want to write unprintable characters.
@<Basic printing...@>=
void mp_print_char (MP mp, ASCII_code k) { /* prints a single character */
- if (mp->selector < pseudo || mp->selector >= write_file) {
+ if (mp->utf8_mode || mp->selector < pseudo || mp->selector >= write_file) {
mp_print_visible_char (mp, k);
} else if (@<Character |k| cannot be printed@>) {
mp_print (mp, "^^");
@@ -3272,6 +3274,7 @@ mp_begin_group, /* beginning of a group (\&{begingroup}) */
mp_nullary, /* an operator without arguments (e.g., \&{normaldeviate}) */
mp_unary, /* an operator with one argument (e.g., \&{sqrt}) */
mp_str_op, /* convert a suffix to a string (\&{str}) */
+mp_void_op, /* convert a suffix to a boolean (\&{void}) */
mp_cycle, /* close a cyclic path (\&{cycle}) */
mp_primary_binary, /* binary operation taking `\&{of}' (e.g., \&{point}) */
mp_capsule_token, /* a value that has been put into a token list */
@@ -4528,8 +4531,9 @@ for (k = 0; k < ' '; k++)
mp->char_class[k] = invalid_class;
mp->char_class['\t'] = space_class;
mp->char_class['\f'] = space_class;
-for (k = 127; k <= 255; k++)
- mp->char_class[k] = invalid_class;
+for (i=127;i<=255;i++) {
+ mp->char_class[i] = mp->utf8_mode ? letter_class : invalid_class;
+}
@* The hash table.
@@ -5028,6 +5032,8 @@ mp_primitive (mp, "step", mp_step_token, 0);
@:step_}{\&{step} primitive@>;
mp_primitive (mp, "str", mp_str_op, 0);
@:str_}{\&{str} primitive@>;
+mp_primitive (mp, "void", mp_void_op, 0);
+@:void_}{\&{void} primitive@>;
mp_primitive (mp, "tension", mp_tension, 0);
@:tension_}{\&{tension} primitive@>;
mp_primitive (mp, "to", mp_to_token, 0);
@@ -5160,6 +5166,9 @@ break;
case mp_str_op:
mp_print (mp, "str");
break;
+case mp_void_op:
+mp_print (mp, "void");
+break;
case mp_tension:
mp_print (mp, "tension");
break;
@@ -15837,7 +15846,7 @@ CONTINUE:
number_to_scaled (stack_min (y_packet (mp->xy))) - number_to_scaled (stack_max (v_packet (mp->uv)))) {
if (number_to_scaled (mp->cur_t) >= number_to_scaled (mp->max_t)) {
if ( number_equal(mp->max_t, x_two_t) || number_greater(mp->max_t,x_two_t_low_precision)) { /* we've done 17+2 bisections */
- number_divide_int(mp->cur_t,1<<2);number_divide_int(mp->cur_tt,1<<2); /* restore values due bit precision */
+ number_divide_int(mp->cur_t,1<<2);number_divide_int(mp->cur_tt,1<<2); /* restore values due bit precision */
set_number_from_scaled (mp->cur_t, ((number_to_scaled (mp->cur_t) + 1)/2));
set_number_from_scaled (mp->cur_tt, ((number_to_scaled (mp->cur_tt) + 1)/2));
return;
@@ -20103,7 +20112,7 @@ line and preceded by a space or at the beginning of a line.
txt[size] = '\0';
ptr = txt;
} else {
- /* strip trailing whitespace, we have a |'\0'| so we are off by one */
+ /* strip trailing whitespace, we have a |'\0'| so we are off by one */
/* |while ((size > 1) && (mp->char_class[(ASCII_code) txt[size-2]] == space_class| $\vbv\vbv$ |txt[size-2] == '\n')) | */
while ((size > 1) && (mp->char_class[(ASCII_code) txt[size-1]] == space_class || txt[size-1] == '\n')) {
decr(size);
@@ -23752,6 +23761,25 @@ RESTART:
mp->cur_exp.type = mp_string_type;
goto DONE;
break;
+ case mp_void_op:
+ {
+ /* Convert a suffix to a boolean */
+ mp_value new_expr;
+ memset(&new_expr,0,sizeof(mp_value));
+ new_number(new_expr.data.n);
+ mp_get_x_next (mp);
+ mp_scan_suffix (mp);
+ if (cur_exp_node() == NULL) {
+ set_number_from_boolean (new_expr.data.n, mp_true_code);
+ } else {
+ set_number_from_boolean (new_expr.data.n, mp_false_code);
+ }
+ mp_flush_cur_exp (mp, new_expr);
+ cur_exp_node() = NULL; /* !! do not replace with |set_cur_exp_node()| !! */
+ mp->cur_exp.type = mp_boolean_type;
+ goto DONE;
+ }
+ break;
case mp_internal_quantity:
/* Scan an internal numeric quantity */
/* If an internal quantity appears all by itself on the left of an