summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/web2c/luatexdir/NEWS7
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luainit.w4
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/conditional.w8
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/extensions.h10
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/extensions.w58
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/printing.w4
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/scanning.h3
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/scanning.w51
8 files changed, 17 insertions, 128 deletions
diff --git a/Build/source/texk/web2c/luatexdir/NEWS b/Build/source/texk/web2c/luatexdir/NEWS
index 61b7f284c05..41b31037ef6 100644
--- a/Build/source/texk/web2c/luatexdir/NEWS
+++ b/Build/source/texk/web2c/luatexdir/NEWS
@@ -4,8 +4,6 @@ This file is in the public domain.
==============================================================
Luatex beta-0.85.0 was released 2015111400 (5509)
==============================================================
-
-
-- roadmap
The 0.85 release is has a lot of changes. It is the prelude to 0.90 which itself is
@@ -99,7 +97,8 @@ where the penalty will be stored with the node. Default is hyphenpenalty.
-- file io
texio.write/write_nl now writes to file if the first argument is a (valid) number
-reference to a file opened at the tex end
+reference to a file opened at the tex end; you can now open 128 files from the tex end
+(0..127) and the system command is no longer executed with 18
-- lua interface
@@ -2565,7 +2564,7 @@ Other news:
we probably introduced new problems as well).
* Most (all?) files now have a corrected Copyright header,
- and link in $Id: NEWS 5508 2015-11-14 11:58:08Z luigi $ and $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/NEWS $ into the object file.
+ and link in $Id: NEWS 5538 2015-11-18 08:36:25Z luigi $ and $URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/NEWS $ into the object file.
* Some unnecessary files were removed from the distribution.
diff --git a/Build/source/texk/web2c/luatexdir/lua/luainit.w b/Build/source/texk/web2c/luatexdir/lua/luainit.w
index 1fe90a888ac..c95c29d5aaf 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luainit.w
+++ b/Build/source/texk/web2c/luatexdir/lua/luainit.w
@@ -89,8 +89,8 @@ const_string LUATEX_IHELP[] = {
" --progname=STRING set the program name to STRING",
" --recorder enable filename recorder",
" --safer disable easily exploitable lua commands",
- " --[no-]shell-escape disable/enable \\write18{SHELL COMMAND}",
- " --shell-restricted restrict \\write18 to a list of commands given in texmf.cnf",
+ " --[no-]shell-escape disable/enable system commands",
+ " --shell-restricted restrict system commands to a list of commands given in texmf.cnf",
" --synctex=NUMBER enable synctex",
" --version display version and exit",
"",
diff --git a/Build/source/texk/web2c/luatexdir/tex/conditional.w b/Build/source/texk/web2c/luatexdir/tex/conditional.w
index 4c25a7a922f..53967087102 100644
--- a/Build/source/texk/web2c/luatexdir/tex/conditional.w
+++ b/Build/source/texk/web2c/luatexdir/tex/conditional.w
@@ -418,12 +418,8 @@ void conditional(void)
scanner_status = save_scanner_status;
break;
case if_eof_code:
- /* bad this system check here as it's an extension*/
- scan_four_bit_int_or_18();
- if (cur_val == write_target_system)
- b = !shellenabledp;
- else
- b = (read_open[cur_val] == closed);
+ scan_four_bit_int();
+ b = (read_open[cur_val] == closed);
break;
case if_true_code:
b = true;
diff --git a/Build/source/texk/web2c/luatexdir/tex/extensions.h b/Build/source/texk/web2c/luatexdir/tex/extensions.h
index 819bfa88b14..8cf116169d0 100644
--- a/Build/source/texk/web2c/luatexdir/tex/extensions.h
+++ b/Build/source/texk/web2c/luatexdir/tex/extensions.h
@@ -21,18 +21,12 @@
#ifndef EXTENSIONS_H
# define EXTENSIONS_H
-# define write_target_direct 16
-# define write_target_special 17
-# define write_target_system 18
-# define write_target_overflow last_file_selector+16 /* a signal that we write to console */
-# define last_write_open last_file_selector+2 /* keeps track of open state */
-
extern alpha_file write_file[last_file_selector+1];
extern halfword write_file_mode[last_file_selector+1];
extern halfword write_file_translation[last_file_selector+1];
-extern boolean write_open[last_write_open+1];
+extern boolean write_open[last_file_selector+1];
-# define valid_write_file(n) (((n>=0) && (n<16)) || ((n>18) && (n<last_file_selector)))
+# define valid_write_file(n) ((n>=0) && (n<=last_file_selector))
# define file_can_be_written(n) (valid_write_file(n) && write_open[n])
extern void expand_macros_in_tokenlist(halfword p);
diff --git a/Build/source/texk/web2c/luatexdir/tex/extensions.w b/Build/source/texk/web2c/luatexdir/tex/extensions.w
index 3bf7555fecf..c1e289fd438 100644
--- a/Build/source/texk/web2c/luatexdir/tex/extensions.w
+++ b/Build/source/texk/web2c/luatexdir/tex/extensions.w
@@ -102,7 +102,7 @@ and both of these variables are always |false|.
alpha_file write_file[last_file_selector+1];
halfword write_file_mode[last_file_selector+1];
halfword write_file_translation[last_file_selector+1];
-boolean write_open[last_write_open+1];
+boolean write_open[last_file_selector+1];
scaled neg_wd;
scaled pos_wd;
@@ -346,9 +346,8 @@ static void new_write_whatsit(int w, int check)
scan_int();
if (cur_val < 0)
cur_val = term_only;
- else if ((cur_val > last_file_selector) || (cur_val == write_target_direct) || (cur_val == write_target_special)) {
- /* hh: i need to check what 17 is supposed to do. so let's kind of reserve it */
- cur_val = write_target_overflow;
+ else if (cur_val > last_file_selector) {
+ cur_val = term_and_log;
}
}
write_stream(tail) = cur_val;
@@ -522,17 +521,13 @@ void write_out(halfword p)
{
int old_setting; /* holds print |selector| */
int j; /* write stream number */
- boolean clobbered; /* system string is ok? */
- int ret; /* return value from |runsystem| */
char *s, *ss; /* line to be written, as a C string */
int callback_id;
int lua_retval;
expand_macros_in_tokenlist(p);
old_setting = selector;
j = write_stream(p);
- if (j == write_target_system) {
- selector = new_string;
- } else if (write_open[j]) {
+ if (write_open[j]) {
selector = j;
} else if ((j == term_only) && (selector == term_and_log)) {
/* write to the terminal if file isn't open */
@@ -558,49 +553,6 @@ void write_out(halfword p)
xfree(s);
print_ln();
flush_list(def_ref);
- if (j == write_target_system) {
- cur_string[cur_length] = '\0'; /* Convert newline to null. */
- if (tracing_online <= 0)
- selector = log_only; /* Show what we're doing in the log file. */
- else
- selector = term_and_log; /* Show what we're doing. */
- /* If the log file isn't open yet, we can only send output to the terminal.
- Calling |open_log_file| from here seems to result in bad data in the log.
- */
- if (!log_opened_global)
- selector = term_only;
- tprint_nl("runsystem(");
- tprint((char *) cur_string);
- tprint(")...");
- if (shellenabledp) {
- clobbered = false;
- if (strlen((char *) cur_string) != cur_length)
- clobbered = true;
- /* minimal checking: NUL not allowed in argument string of |system|() */
- if (clobbered) {
- tprint("clobbered");
- } else {
- /* We have the command. See if we're allowed to execute it,
- and report in the log. We don't check the actual exit status of
- the command, or do anything with the output. */
- ret = runsystem((char *) cur_string);
- if (ret == -1)
- tprint("quotation error in system command");
- else if (ret == 0)
- tprint("disabled (restricted)");
- else if (ret == 1)
- tprint("executed");
- else if (ret == 2)
- tprint("executed safely (allowed)");
- }
- } else {
- tprint("disabled"); /* |shellenabledp| false */
- }
- print_char('.');
- tprint_nl("");
- print_ln();
- cur_length = 0; /* erase the string */
- }
selector = old_setting;
}
@@ -615,7 +567,7 @@ void finalize_write_files(void) {
void initialize_write_files(void) {
int k;
- for (k = 0; k <= last_write_open; k++) {
+ for (k = 0; k <= last_file_selector; k++) {
write_open[k] = false;
}
}
diff --git a/Build/source/texk/web2c/luatexdir/tex/printing.w b/Build/source/texk/web2c/luatexdir/tex/printing.w
index 6cab2dd0060..2f11e7836dd 100644
--- a/Build/source/texk/web2c/luatexdir/tex/printing.w
+++ b/Build/source/texk/web2c/luatexdir/tex/printing.w
@@ -486,7 +486,7 @@ void print_banner(const char *v, int ver)
wterm(' ');
if (restrictedshell)
fprintf(term_out, "restricted ");
- fprintf(term_out, "\\write18 enabled.\n");
+ fprintf(term_out, "system commands enabled.\n");
}
} else if (callback_id > 0) {
run_callback(callback_id, "->");
@@ -525,7 +525,7 @@ void log_banner(const char *v, int ver)
wlog(' ');
if (restrictedshell)
fprintf(log_file, "restricted ");
- fprintf(log_file, "\\write18 enabled.");
+ fprintf(log_file, "system commands enabled.");
}
if (filelineerrorstylep) {
wlog_cr();
diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.h b/Build/source/texk/web2c/luatexdir/tex/scanning.h
index 6c858a2c25e..8831901c303 100644
--- a/Build/source/texk/web2c/luatexdir/tex/scanning.h
+++ b/Build/source/texk/web2c/luatexdir/tex/scanning.h
@@ -1,5 +1,5 @@
/* scanning.h
-
+
Copyright 2009 Taco Hoekwater <taco@luatex.org>
This file is part of LuaTeX.
@@ -56,7 +56,6 @@ extern void scan_limited_int(int max, const char *name);
extern void scan_fifteen_bit_int(void);
extern void scan_fifty_one_bit_int(void);
-extern void scan_four_bit_int_or_18(void);
# define octal_token (other_token+'\'') /* apostrophe, indicates an octal constant */
# define hex_token (other_token+'"') /* double quote, indicates a hex constant */
diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.w b/Build/source/texk/web2c/luatexdir/tex/scanning.w
index 06b89cd585c..7b1172f140a 100644
--- a/Build/source/texk/web2c/luatexdir/tex/scanning.w
+++ b/Build/source/texk/web2c/luatexdir/tex/scanning.w
@@ -19,7 +19,6 @@
@ @c
-
#include "ptexlib.h"
@ @c
@@ -39,7 +38,6 @@
#define text_direction int_par(text_direction_code)
#define body_direction int_par(body_direction_code)
-
@ Let's turn now to some procedures that \TeX\ calls upon frequently to digest
certain kinds of patterns in the input. Most of these are quite simple;
some are quite elaborate. Almost all of the routines call |get_x_token|,
@@ -72,7 +70,6 @@ void scan_left_brace(void)
}
}
-
@ The |scan_optional_equals| routine looks for an optional `\.=' sign preceded
by optional spaces; `\.{\\relax}' is not ignored here.
@@ -87,7 +84,6 @@ void scan_optional_equals(void)
back_input();
}
-
@ Here is a procedure that sounds an alarm when mu and non-mu units
are being switched.
@@ -99,7 +95,6 @@ static void mu_error(void)
error();
}
-
@ The next routine `|scan_something_internal|' is used to fetch internal
numeric quantities like `\.{\\hsize}', and also to handle the `\.{\\the}'
when expanding constructions like `\.{\\the\\toks0}' and
@@ -150,7 +145,6 @@ int cur_val_level; /* the ``level'' of this value */
cur_val_level=B; \
} while (0)
-
@ When a |glue_val| changes to a |dimen_val|, we use the width component
of the glue; there is no need to decrease the reference count, since it
has not yet been increased. When a |dimen_val| changes to an |int_val|,
@@ -190,7 +184,6 @@ static void negate_cur_val(boolean delete_glue)
}
}
-
@ Some of the internal items can be fetched both routines,
and these have been split off into the next routine, that
returns true if the command code was understood
@@ -589,8 +582,6 @@ void scan_something_simple(halfword cmd, halfword subitem)
}
}
-
-
@ OK, we're ready for |scan_something_internal| itself. A second parameter,
|negative|, is set |true| if the value that is found should be negated.
It is assumed that |cur_cmd| and |cur_chr| represent the first token of
@@ -835,7 +826,6 @@ void scan_something_internal(int level, boolean negative)
}
}
-
@ It is nice to have routines that say what they do, so the original
|scan_eight_bit_int| is superceded by |scan_register_num| and
|scan_mark_num|. It may become split up even further in the future.
@@ -902,28 +892,6 @@ void scan_fifty_one_bit_int(void)
cur_val = iiii;
}
-
-@ To be able to determine whether \.{\\write18} is enabled from within
-\TeX\ we also implement \.{\\eof18}. We sort of cheat by having an
-additional route |scan_four_bit_int_or_18| which is the same as
-|scan_four_bit_int| except it also accepts the value 18.
-
-@c
-void scan_four_bit_int_or_18(void)
-{
- scan_int();
- if ((cur_val < 0) || ((cur_val > 15) && (cur_val != 18))) {
- print_err("Bad number");
- help2("Since I expected to read a number between 0 and 15,",
- "I changed this one to zero.");
- int_error(cur_val);
- cur_val = 0;
- }
-}
-
-
-
-
@ An integer number can be preceded by any number of spaces and `\.+' or
`\.-' signs. Then comes either a decimal constant (i.e., radix 10), an
octal constant (i.e., radix 8, preceded by~'), a hexadecimal constant
@@ -937,7 +905,6 @@ otherwise |radix| is set to zero. An optional space follows a constant.
@c
int radix; /* |scan_int| sets this to 8, 10, 16, or zero */
-
@ The |scan_int| routine is used also to scan the integer part of a
fraction; for example, the `\.3' in `\.{3.14159}' will be found by
|scan_int|. The |scan_dimen| routine assumes that |cur_tok=point_token|
@@ -1092,7 +1059,6 @@ void scan_int(void)
negate(cur_val);
}
-
@ The following code is executed when |scan_something_internal| was
called asking for |mu_val|, when we really wanted a ``mudimen'' instead
of ``muglue.''
@@ -1108,8 +1074,6 @@ static void coerce_glue(void)
}
}
-
-
@ The |scan_dimen| routine is similar to |scan_int|, but it sets |cur_val| to
a |scaled| value, i.e., an integral number of sp. One of its main tasks
is therefore to interpret the abbreviations for various kinds of units and
@@ -1421,7 +1385,6 @@ void scan_dimen(boolean mu, boolean inf, boolean shortcut)
negate(cur_val);
}
-
@ The final member of \TeX's value-scanning trio is |scan_glue|, which
makes |cur_val| point to a glue specification. The reference count of that
glue spec will take account of the fact that |cur_val| is pointing to~it.
@@ -1571,7 +1534,6 @@ void scan_scaled(void)
negate(cur_val);
}
-
@ This procedure is supposed to scan something like `\.{\\skip\\count12}',
i.e., whatever can follow `\.{\\the}', and it constructs a token list
containing something like `\.{-3.0pt minus 0.5fill}'.
@@ -1698,8 +1660,6 @@ str_number the_scanned_result(void)
return r;
}
-
-
@ The following routine is used to implement `\.{\\fontdimen} |n| |f|'.
The boolean parameter |writing| is set |true| if the calling program
intends to change the parameter value.
@@ -1775,7 +1735,6 @@ void get_font_dimen(void)
scanned_result(cur_val, dimen_val_level);
}
-
@ Here's a similar procedure that returns a pointer to a rule node. This
routine is called just after \TeX\ has seen \.{\\hrule} or \.{\\vrule};
therefore |cur_cmd| will be either |hrule| or |vrule|. The idea is to store
@@ -1909,7 +1868,6 @@ void scan_general_text(void)
def_ref = d;
}
-
@ The |get_x_or_protected| procedure is like |get_x_token| except that
protected macros are not expanded.
@@ -1929,7 +1887,6 @@ void get_x_or_protected(void)
}
}
-
@ |scan_toks|. This function returns a pointer to the tail of a new token
list, and it also makes |def_ref| point to the reference count at the
head of that list.
@@ -2098,7 +2055,6 @@ halfword scan_toks(boolean macro_def, boolean xpand)
return p;
}
-
@ Here we declare two trivial procedures in order to avoid mutually
recursive procedures with parameters.
@@ -2155,13 +2111,11 @@ typedef enum {
A=new_spec(zero_glue); \
} while (0)
-
#define normalize_glue(A) do { \
if (stretch(A)==0) stretch_order(A)=normal; \
if (shrink(A)==0) shrink_order(A)=normal; \
} while (0)
-
@ Parenthesized subexpressions can be inside expressions, and this
nesting has a stack. Seven local variables represent the top of the
expression stack: |p| points to pushed-down entries, if any; |l|
@@ -2177,7 +2131,6 @@ numerator for a combined multiplication and division, if any.
#define expr_t_field(A) vlink((A)+2) /* saved term so far */
#define expr_n_field(A) vinfo((A)+2) /* saved numerator */
-
#define expr_add_sub(A,B,C) add_or_sub((A),(B),(C),(r==expr_sub))
#define expr_a(A,B) expr_add_sub((A),(B),max_dimen)
@@ -2206,12 +2159,9 @@ int add_or_sub(int x, int y, int max_answer, boolean negative)
return a;
}
-
#define expr_m(A) A = nx_plus_y((A),f,0)
-
#define expr_d(A) A=quotient((A),f)
-
@ The function |quotient(n,d)| computes the rounded quotient
$q=\lfloor n/d+{1\over2}\rfloor$, when $n$ and $d$ are positive.
@@ -2246,7 +2196,6 @@ int quotient(int n, int d)
#define expr_s(A) A=fract((A),n,f,max_dimen)
-
@ Finally, the function |fract(x,n,d,max_answer)| computes the integer
$q=\lfloor xn/d+{1\over2}\rfloor$, when $x$, $n$, and $d$ are positive
and the result does not exceed |max_answer|. We can't use floating