Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Commit

Permalink
mplib: new primitive void (TH)
Browse files Browse the repository at this point in the history
git-svn-id: https://serveur-svn.lri.fr/svn/modhel/luatex/trunk@7135 0b2b3880-5936-4365-a048-eb17d2e5a6bf
  • Loading branch information
luigiScarso committed Apr 23, 2019
1 parent 125420b commit 3a49e9a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
7 changes: 5 additions & 2 deletions source/texk/web2c/mplibdir/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
2019-03-06 Luigi Scarso <[email protected]>
* Code clean-up.
* Code clean-up.


2019-02-06: Taco Hoekwater <[email protected]>
* 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 <[email protected]>
* 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.
Expand Down
25 changes: 25 additions & 0 deletions source/texk/web2c/mplibdir/mp.w
Original file line number Diff line number Diff line change
Expand Up @@ -3272,6 +3272,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 */
Expand Down Expand Up @@ -5028,6 +5029,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);
Expand Down Expand Up @@ -5160,6 +5163,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;
Expand Down Expand Up @@ -23752,6 +23758,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
Expand Down

0 comments on commit 3a49e9a

Please sign in to comment.