summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/lua
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2010-01-25 12:30:04 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2010-01-25 12:30:04 +0000
commit65c37b17f39210ff32ba3ec1415d5f5a3f8e86ff (patch)
treea23710d061b8695f9eec30cbf5591e6016432089 /Build/source/texk/web2c/luatexdir/lua
parenta6ff9d2b253991c7c8eb94f2977abb10ad466480 (diff)
texk/web2c/luatexdir: compiler warnings
git-svn-id: svn://tug.org/texlive/trunk@16817 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lua')
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c34
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lfontlib.c12
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/limglib.c22
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lkpselib.c10
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/llanglib.c6
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/llualib.c22
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lnodelib.c38
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/loslibext.c31
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lpdflib.c8
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lstatslib.c18
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/ltexiolib.c12
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/ltexlib.c113
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/ltokenlib.c16
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luainit.c35
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luanode.c14
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luastuff.c14
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luatex.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luatoken.c14
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/texluac.c2
19 files changed, 214 insertions, 209 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c
index 89d233e15b6..6b350a1249b 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c
@@ -23,7 +23,7 @@
static const char _svn_version[] =
"$Id: lcallbacklib.c 2448 2009-06-08 07:43:50Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.40.6/source/texk/web2c/luatexdir/lua/lcallbacklib.c $";
-extern int do_run_callback(int special, char *values, va_list vl);
+static int do_run_callback(int special, const char *values, va_list vl);
extern int lua_traceback(lua_State * L);
int callback_count = 0;
@@ -71,7 +71,7 @@ static const char *const callbacknames[] = {
int callback_callbacks_id = 0;
-void get_lua_boolean(char *table, char *name, boolean * target)
+void get_lua_boolean(const char *table, const char *name, boolean * target)
{
int stacktop;
stacktop = lua_gettop(Luas);
@@ -89,7 +89,7 @@ void get_lua_boolean(char *table, char *name, boolean * target)
return;
}
-void get_saved_lua_boolean(int r, char *name, boolean * target)
+void get_saved_lua_boolean(int r, const char *name, boolean * target)
{
int stacktop;
stacktop = lua_gettop(Luas);
@@ -107,7 +107,7 @@ void get_saved_lua_boolean(int r, char *name, boolean * target)
return;
}
-void get_lua_number(char *table, char *name, integer * target)
+void get_lua_number(const char *table, const char *name, integer * target)
{
int stacktop;
stacktop = lua_gettop(Luas);
@@ -123,7 +123,7 @@ void get_lua_number(char *table, char *name, integer * target)
return;
}
-void get_saved_lua_number(int r, char *name, integer * target)
+void get_saved_lua_number(int r, const char *name, integer * target)
{
int stacktop;
stacktop = lua_gettop(Luas);
@@ -140,7 +140,7 @@ void get_saved_lua_number(int r, char *name, integer * target)
}
-void get_lua_string(char *table, char *name, char **target)
+void get_lua_string(const char *table, const char *name, const char **target)
{
int stacktop;
stacktop = lua_gettop(Luas);
@@ -149,14 +149,14 @@ void get_lua_string(char *table, char *name, char **target)
if (lua_istable(Luas, -1)) {
lua_getfield(Luas, -1, name);
if (lua_isstring(Luas, -1)) {
- *target = (char *) lua_tostring(Luas, -1);
+ *target = lua_tostring(Luas, -1);
}
}
lua_settop(Luas, stacktop);
return;
}
-void get_saved_lua_string(int r, char *name, char **target)
+void get_saved_lua_string(int r, const char *name, const char **target)
{
int stacktop;
stacktop = lua_gettop(Luas);
@@ -165,7 +165,7 @@ void get_saved_lua_string(int r, char *name, char **target)
if (lua_istable(Luas, -1)) {
lua_getfield(Luas, -1, name);
if (lua_isstring(Luas, -1)) {
- *target = (char *) lua_tostring(Luas, -1);
+ *target = lua_tostring(Luas, -1);
}
}
lua_settop(Luas, stacktop);
@@ -181,7 +181,7 @@ void get_saved_lua_string(int r, char *name, char **target)
#define CALLBACK_CHARNUM 'c'
-int run_saved_callback(int r, char *name, char *values, ...)
+int run_saved_callback(int r, const char *name, const char *values, ...)
{
va_list args;
int ret = 0;
@@ -216,7 +216,7 @@ boolean get_callback(lua_State * L, int i)
}
}
-int run_and_save_callback(int i, char *values, ...)
+int run_and_save_callback(int i, const char *values, ...)
{
va_list args;
int ret = 0;
@@ -235,7 +235,7 @@ int run_and_save_callback(int i, char *values, ...)
}
-int run_callback(int i, char *values, ...)
+int run_callback(int i, const char *values, ...)
{
va_list args;
int ret = 0;
@@ -250,7 +250,7 @@ int run_callback(int i, char *values, ...)
return ret;
}
-int do_run_callback(int special, char *values, va_list vl)
+int do_run_callback(int special, const char *values, va_list vl)
{
int ret;
size_t len;
@@ -429,7 +429,7 @@ void destroy_saved_callback(int i)
static int callback_register(lua_State * L)
{
int cb;
- char *s;
+ const char *s;
if (!lua_isstring(L, 1) ||
((!lua_isfunction(L, 2)) &&
(!lua_isnil(L, 2)) &&
@@ -438,7 +438,7 @@ static int callback_register(lua_State * L)
lua_pushstring(L, "Invalid arguments to callback.register.");
return 2;
}
- s = (char *) lua_tostring(L, 1);
+ s = lua_tostring(L, 1);
for (cb = 0; cb < total_callbacks; cb++) {
if (strcmp(callbacknames[cb], s) == 0)
break;
@@ -467,13 +467,13 @@ static int callback_register(lua_State * L)
static int callback_find(lua_State * L)
{
int cb;
- char *s;
+ const char *s;
if (!lua_isstring(L, 1)) {
lua_pushnil(L);
lua_pushstring(L, "Invalid arguments to callback.find.");
return 2;
}
- s = (char *) lua_tostring(L, 1);
+ s = lua_tostring(L, 1);
for (cb = 0; cb < total_callbacks; cb++) {
if (strcmp(callbacknames[cb], s) == 0)
break;
diff --git a/Build/source/texk/web2c/luatexdir/lua/lfontlib.c b/Build/source/texk/web2c/luatexdir/lua/lfontlib.c
index 418d8439318..c07da9d0717 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lfontlib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lfontlib.c
@@ -30,9 +30,7 @@ static const char _svn_version[] =
# include <sys/time.h>
#endif
-
-/* this function is in vfovf.c for the moment */
-extern int make_vf_table(lua_State * L, char *name, scaled s);
+#include "inc-vfovf.h"
static int get_fontid(void)
{
@@ -47,9 +45,9 @@ static int font_read_tfm(lua_State * L)
internalfontnumber f;
scaled s;
int k;
- char *cnom;
+ const char *cnom;
if (lua_isstring(L, 1)) {
- cnom = (char *) lua_tostring(L, 1);
+ cnom = lua_tostring(L, 1);
if (lua_isnumber(L, 2)) {
s = (integer) lua_tonumber(L, 2);
if (strlen(cnom)) {
@@ -82,9 +80,9 @@ static int font_read_tfm(lua_State * L)
static int font_read_vf(lua_State * L)
{
scaled s;
- char *cnom;
+ const char *cnom;
if (lua_isstring(L, 1)) {
- cnom = (char *) lua_tostring(L, 1);
+ cnom = lua_tostring(L, 1);
if (strlen(cnom)) {
if (lua_isnumber(L, 2)) {
s = lua_tonumber(L, 2);
diff --git a/Build/source/texk/web2c/luatexdir/lua/limglib.c b/Build/source/texk/web2c/luatexdir/lua/limglib.c
index c72f14fe572..090f3d43d82 100644
--- a/Build/source/texk/web2c/luatexdir/lua/limglib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/limglib.c
@@ -291,7 +291,7 @@ static void lua_to_image(lua_State * L, image * a)
else if (lua_type(L, -1) == LUA_TNUMBER)
img_width(a) = lua_tointeger(L, -1);
else if (lua_type(L, -1) == LUA_TSTRING)
- img_width(a) = dimen_to_number(L, (char *) lua_tostring(L, -1));
+ img_width(a) = dimen_to_number(L, lua_tostring(L, -1));
else
luaL_error(L,
"image.width needs integer or nil value or dimension string");
@@ -305,7 +305,7 @@ static void lua_to_image(lua_State * L, image * a)
else if (lua_type(L, -1) == LUA_TNUMBER)
img_height(a) = lua_tointeger(L, -1);
else if (lua_type(L, -1) == LUA_TSTRING)
- img_height(a) = dimen_to_number(L, (char *) lua_tostring(L, -1));
+ img_height(a) = dimen_to_number(L, lua_tostring(L, -1));
else
luaL_error(L,
"image.height needs integer or nil value or dimension string");
@@ -319,7 +319,7 @@ static void lua_to_image(lua_State * L, image * a)
else if (lua_type(L, -1) == LUA_TNUMBER)
img_depth(a) = lua_tointeger(L, -1);
else if (lua_type(L, -1) == LUA_TSTRING)
- img_depth(a) = dimen_to_number(L, (char *) lua_tostring(L, -1));
+ img_depth(a) = dimen_to_number(L, lua_tostring(L, -1));
else
luaL_error(L,
"image.depth needs integer or nil value or dimension string");
@@ -408,7 +408,7 @@ static void lua_to_image(lua_State * L, image * a)
img_bbox(d)[i - 1] = lua_tointeger(L, -1);
else if (lua_type(L, -1) == LUA_TSTRING)
img_bbox(d)[i - 1] =
- dimen_to_number(L, (char *) lua_tostring(L, -1));
+ dimen_to_number(L, lua_tostring(L, -1));
else
luaL_error(L,
"image.bbox table needs integer value or dimension string elements");
@@ -450,7 +450,7 @@ static void lua_to_image(lua_State * L, image * a)
/**********************************************************************/
-void fix_image_size(lua_State * L, image * a)
+static void fix_image_size(lua_State * L, image * a)
{
if (!img_is_scaled(a) || is_wd_running(a) || is_ht_running(a)
|| is_dp_running(a)) {
@@ -460,7 +460,7 @@ void fix_image_size(lua_State * L, image * a)
}
}
-void copy_image(lua_State * L, lua_Number scale)
+static void copy_image(lua_State * L, lua_Number scale)
{
image *a, **aa, *b, **bb;
if (lua_gettop(L) != 1)
@@ -679,11 +679,11 @@ static int l_image_keys(lua_State * L)
static int l_image_types(lua_State * L)
{
int i;
- char **p;
+ const char **p;
if (lua_gettop(L) != 0)
luaL_error(L, "img.types() goes without argument");
lua_newtable(L); /* t */
- for (i = 1, p = (char **) (imgtype_s + 1); *p != NULL; p++, i++) {
+ for (i = 1, p = (const char **) (imgtype_s + 1); *p != NULL; p++, i++) {
lua_pushinteger(L, (int) i); /* k t */
lua_pushstring(L, *p); /* v k t */
lua_settable(L, -3); /* t */
@@ -694,11 +694,11 @@ static int l_image_types(lua_State * L)
static int l_image_boxes(lua_State * L)
{
int i;
- char **p;
+ const char **p;
if (lua_gettop(L) != 0)
luaL_error(L, "img.boxes() goes without argument");
lua_newtable(L); /* t */
- for (i = 1, p = (char **) (pdfboxspec_s + 1); *p != NULL; p++, i++) {
+ for (i = 1, p = (const char **) (pdfboxspec_s + 1); *p != NULL; p++, i++) {
lua_pushinteger(L, (int) i); /* k t */
lua_pushstring(L, *p); /* v k t */
lua_settable(L, -3); /* t */
@@ -828,7 +828,7 @@ static const struct luaL_Reg img_dict_m[] = {
/**********************************************************************/
-void preset_environment(lua_State * L, const parm_struct * p)
+static void preset_environment(lua_State * L, const parm_struct * p)
{
int i;
lua_newtable(L); /* t */
diff --git a/Build/source/texk/web2c/luatexdir/lua/lkpselib.c b/Build/source/texk/web2c/luatexdir/lua/lkpselib.c
index 437f118942b..d4af0600dde 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lkpselib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lkpselib.c
@@ -163,7 +163,7 @@ int program_name_set = 0;
static int find_file(lua_State * L)
{
int i;
- char *st;
+ const char *st;
int ftype = kpse_tex_format;
int mexist = 0;
TEST_PROGRAM_NAME_SET;
@@ -171,7 +171,7 @@ static int find_file(lua_State * L)
lua_pushstring(L, "not a file name");
lua_error(L);
}
- st = (char *) lua_tostring(L, 1);
+ st = lua_tostring(L, 1);
i = lua_gettop(L);
while (i > 1) {
if (lua_isboolean(L, i)) {
@@ -206,7 +206,7 @@ static int lua_kpathsea_find_file(lua_State * L)
int ftype = kpse_tex_format;
int mexist = 0;
kpathsea *kp = (kpathsea *) luaL_checkudata(L, 1, KPATHSEA_METATABLE);
- char *st = (char *) luaL_checkstring(L, 2);
+ const char *st = luaL_checkstring(L, 2);
i = lua_gettop(L);
while (i > 2) {
if (lua_isboolean(L, i)) {
@@ -403,8 +403,8 @@ static int lua_kpathsea_new(lua_State * L)
{
kpathsea kpse = NULL;
kpathsea *kp = NULL;
- char *argv = (char *) luaL_checkstring(L, 1);
- char *liar = (char *) luaL_optstring(L, 2, argv);
+ const char *argv = luaL_checkstring(L, 1);
+ const char *liar = luaL_optstring(L, 2, argv);
kpse = kpathsea_new();
kpathsea_set_program_name(kpse, argv, liar);
kp = (kpathsea *) lua_newuserdata(L, sizeof(kpathsea *));
diff --git a/Build/source/texk/web2c/luatexdir/lua/llanglib.c b/Build/source/texk/web2c/luatexdir/lua/llanglib.c
index 73737f24922..e71565f94b4 100644
--- a/Build/source/texk/web2c/luatexdir/lua/llanglib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/llanglib.c
@@ -73,7 +73,7 @@ static int lang_patterns(lua_State * L)
lua_pushstring(L, "lang.patterns(): argument should be a string");
return lua_error(L);
}
- load_patterns(*lang_ptr, (unsigned char *) lua_tostring(L, 2));
+ load_patterns(*lang_ptr, (const unsigned char *) lua_tostring(L, 2));
return 0;
} else {
if ((*lang_ptr)->patterns != NULL) {
@@ -104,7 +104,7 @@ static int lang_hyphenation(lua_State * L)
"lang.hyphenation(): argument should be a string");
return lua_error(L);
}
- load_hyphenation(*lang_ptr, (unsigned char *) lua_tostring(L, 2));
+ load_hyphenation(*lang_ptr, (const unsigned char *) lua_tostring(L, 2));
return 0;
} else {
if ((*lang_ptr)->exceptions != 0) {
@@ -206,7 +206,7 @@ static int do_lang_clean(lua_State * L)
lua_pushstring(L, "lang.clean(): argument should be a string");
return lua_error(L);
}
- (void) clean_hyphenation((char *) lua_tostring(L, 1), &cleaned);
+ (void) clean_hyphenation(lua_tostring(L, 1), &cleaned);
lua_pushstring(L, cleaned);
return 1;
}
diff --git a/Build/source/texk/web2c/luatexdir/lua/llualib.c b/Build/source/texk/web2c/luatexdir/lua/llualib.c
index 67debd8c5fa..fb1fe305a55 100644
--- a/Build/source/texk/web2c/luatexdir/lua/llualib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/llualib.c
@@ -38,9 +38,7 @@ static bytecode *lua_bytecode_registers = NULL;
integer luabytecode_max = -1;
unsigned int luabytecode_bytes = 0;
-char *luanames[65536] = { NULL };
-
-extern char *luanames[];
+static char *luanames[65536] = { NULL };
char *get_lua_name(int i)
{
@@ -159,7 +157,7 @@ static int bytecode_register_shadow_get(lua_State * L, int k)
}
-int writer(lua_State * L, const void *b, size_t size, void *B)
+static int writer(lua_State * L, const void *b, size_t size, void *B)
{
bytecode *buf = (bytecode *) B;
(void) L; /* for -Wunused */
@@ -173,7 +171,7 @@ int writer(lua_State * L, const void *b, size_t size, void *B)
return 0;
}
-const char *reader(lua_State * L, void *ud, size_t * size)
+static const char *reader(lua_State * L, void *ud, size_t * size)
{
bytecode *buf = (bytecode *) ud;
(void) L; /* for -Wunused */
@@ -187,7 +185,7 @@ const char *reader(lua_State * L, void *ud, size_t * size)
return (const char *) buf->buf;
}
-int get_bytecode(lua_State * L)
+static int get_bytecode(lua_State * L)
{
int k;
k = (int) luaL_checkinteger(L, -1);
@@ -211,7 +209,7 @@ int get_bytecode(lua_State * L)
return 1;
}
-int set_bytecode(lua_State * L)
+static int set_bytecode(lua_State * L)
{
int k, ltype;
unsigned int i;
@@ -265,10 +263,10 @@ int set_bytecode(lua_State * L)
}
-int set_luaname(lua_State * L)
+static int set_luaname(lua_State * L)
{
int k;
- char *s;
+ const char *s;
if (lua_gettop(L) == 3) {
k = (int) luaL_checkinteger(L, 2);
if (k > 65535 || k < 0) {
@@ -279,7 +277,7 @@ int set_luaname(lua_State * L)
luanames[k] = NULL;
}
if (lua_isstring(L, 3)) {
- s = (char *) lua_tostring(L, 3);
+ s = lua_tostring(L, 3);
if (s != NULL)
luanames[k] = xstrdup(s);
}
@@ -288,7 +286,7 @@ int set_luaname(lua_State * L)
return 0;
}
-int get_luaname(lua_State * L)
+static int get_luaname(lua_State * L)
{
int k;
k = (int) luaL_checkinteger(L, 2);
@@ -316,7 +314,7 @@ static const struct luaL_reg lualib[] = {
{NULL, NULL} /* sentinel */
};
-int luaopen_lua(lua_State * L, char *fname)
+int luaopen_lua(lua_State * L, const char *fname)
{
luaL_register(L, "lua", lualib);
make_table(L, "bytecode", "getbytecode", "setbytecode");
diff --git a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
index 76c6c72ab20..d78fea95d8c 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
@@ -29,13 +29,13 @@ static const char _svn_version[] =
#define init_luaS_index(a) do { \
lua_pushliteral(L,#a); \
- luaS_##a##_ptr = (char *)lua_tostring(L,-1); \
+ luaS_##a##_ptr = lua_tostring(L,-1); \
luaS_##a##_index = luaL_ref (L,LUA_REGISTRYINDEX); \
} while (0)
#define make_luaS_index(a) \
static int luaS_##a##_index = 0; \
- static char * luaS_##a##_ptr = NULL
+ static const char * luaS_##a##_ptr = NULL
#define luaS_index(a) luaS_##a##_index
@@ -70,7 +70,7 @@ int do_get_node_type_id(lua_State * L, int n, node_info * data)
{
register int j;
if (lua_type(L, n) == LUA_TSTRING) {
- char *s = (char *) lua_tostring(L, n);
+ const char *s = lua_tostring(L, n);
for (j = 0; data[j].id != -1; j++) {
if (strcmp(s, data[j].name) == 0)
return j;
@@ -95,7 +95,7 @@ int get_valid_node_type_id(lua_State * L, int n)
if (i == -1) {
if (lua_type(L, n) == LUA_TSTRING) {
lua_pushfstring(L, "Invalid node type id: %s",
- (char *) lua_tostring(L, n));
+ (const char *) lua_tostring(L, n));
} else {
lua_pushfstring(L, "Invalid node type id: %d",
(int) lua_tonumber(L, n));
@@ -112,7 +112,7 @@ int get_valid_node_subtype_id(lua_State * L, int n)
if (i == -1) {
if (lua_type(L, n) == LUA_TSTRING) {
lua_pushfstring(L, "Invalid whatsit node id: %s",
- (char *) lua_tostring(L, n));
+ (const char *) lua_tostring(L, n));
} else {
lua_pushfstring(L, "Invalid whatsit node id: %d",
(int) lua_tonumber(L, n));
@@ -476,7 +476,7 @@ static int lua_nodelib_last_node(lua_State * L)
static int lua_nodelib_hpack(lua_State * L)
{
halfword n, p;
- char *s;
+ const char *s;
integer w = 0;
int m = 1;
n = *(check_isnode(L, 1));
@@ -484,7 +484,7 @@ static int lua_nodelib_hpack(lua_State * L)
w = lua_tointeger(L, 2);
if (lua_gettop(L) > 2) {
if (lua_type(L, 3) == LUA_TSTRING) {
- s = (char *) lua_tostring(L, 3);
+ s = lua_tostring(L, 3);
if (strcmp(s, "additional") == 0)
m = 1;
else if (strcmp(s, "exactly") == 0)
@@ -513,7 +513,7 @@ static int lua_nodelib_hpack(lua_State * L)
static int lua_nodelib_vpack(lua_State * L)
{
halfword n, p;
- char *s;
+ const char *s;
integer w = 0;
int m = 1;
n = *(check_isnode(L, 1));
@@ -521,7 +521,7 @@ static int lua_nodelib_vpack(lua_State * L)
w = lua_tointeger(L, 2);
if (lua_gettop(L) > 2) {
if (lua_type(L, 3) == LUA_TSTRING) {
- s = (char *) lua_tostring(L, 3);
+ s = lua_tostring(L, 3);
if (strcmp(s, "additional") == 0)
m = 1;
else if (strcmp(s, "exactly") == 0)
@@ -606,7 +606,7 @@ make_luaS_index(xoffset);
make_luaS_index(yoffset);
-void initialize_luaS_indexes(lua_State * L)
+static void initialize_luaS_indexes(lua_State * L)
{
init_luaS_index(id);
init_luaS_index(next);
@@ -627,7 +627,7 @@ void initialize_luaS_indexes(lua_State * L)
static int get_node_field_id(lua_State * L, int n, int node)
{
register int t = type(node);
- register char *s = (char *) lua_tostring(L, n);
+ register const char *s = lua_tostring(L, n);
if (luaS_ptr_eq(s, next)) {
return 0;
} else if (luaS_ptr_eq(s, id)) {
@@ -664,7 +664,7 @@ static int get_node_field_id(lua_State * L, int n, int node)
return 2;
} else {
int j;
- char **fields = node_data[t].fields;
+ const char **fields = node_data[t].fields;
if (t == whatsit_node)
fields = whatsit_node_data[subtype(node)].fields;
for (j = 0; fields[j] != NULL; j++) {
@@ -681,7 +681,7 @@ static int get_valid_node_field_id(lua_State * L, int n, int node)
{
int i = get_node_field_id(L, n, node);
if (i == -2) {
- char *s = (char *) lua_tostring(L, n);
+ const char *s = lua_tostring(L, n);
lua_pushfstring(L, "Invalid field id %s for node type %s (%d)", s,
node_data[type(node)].name, subtype(node));
lua_error(L);
@@ -729,7 +729,7 @@ static int lua_nodelib_whatsits(lua_State * L)
static int lua_nodelib_fields(lua_State * L)
{
int i = -1;
- char **fields;
+ const char **fields;
int t = get_valid_node_type_id(L, 1);
if (t == whatsit_node) {
t = get_valid_node_subtype_id(L, 2);
@@ -1971,11 +1971,11 @@ static int nodelib_getlist(lua_State * L, int n)
static int nodelib_getdir(lua_State * L, int n)
{
- char *s = NULL;
+ const char *s = NULL;
int d = 32; /* invalid number */
int a = -1, b = -1, c = -1;
if (lua_type(L, n) == LUA_TSTRING) {
- s = (char *) lua_tostring(L, n);
+ s = lua_tostring(L, n);
if (strlen(s) == 3) {
d = 0;
}
@@ -2021,7 +2021,7 @@ static int nodelib_getdir(lua_State * L, int n)
if ((d > 31) || (d < -64) || (d < 0 && (d + 64) > 31)) {
d = 0;
lua_pushfstring(L, "Bad direction specifier %s",
- (char *) lua_tostring(L, n));
+ (const char *) lua_tostring(L, n));
lua_error(L);
}
return d;
@@ -2035,7 +2035,7 @@ static int nodelib_getdir(lua_State * L, int n)
static str_number nodelib_getstring(lua_State * L, int a)
{
size_t k;
- char *s = (char *) lua_tolstring(L, a, &k);
+ const char *s = lua_tolstring(L, a, &k);
return maketexlstring(s, k);
}
@@ -3177,7 +3177,7 @@ static int lua_nodelib_first_character(lua_State * L)
/* this is too simplistic, but it helps Hans to get going */
-halfword do_ligature_n(halfword prev, halfword stop, halfword lig)
+static halfword do_ligature_n(halfword prev, halfword stop, halfword lig)
{
vlink(lig) = vlink(stop);
vlink(stop) = null;
diff --git a/Build/source/texk/web2c/luatexdir/lua/loslibext.c b/Build/source/texk/web2c/luatexdir/lua/loslibext.c
index 95d27a20f37..f79b0f0daf0 100644
--- a/Build/source/texk/web2c/luatexdir/lua/loslibext.c
+++ b/Build/source/texk/web2c/luatexdir/lua/loslibext.c
@@ -244,10 +244,10 @@ static int spawn_command(const char *file, char *const *argv, char *const *envp)
extern char **environ;
-static char **do_split_command(char *maincmd)
+static char **do_split_command(const char *maincmd)
{
char *piece, *start_piece;
- char *cmd;
+ const char *cmd;
char **cmdline = NULL;
unsigned int i, j;
int ret = 0;
@@ -304,7 +304,7 @@ static char **do_split_command(char *maincmd)
static char **do_flatten_command(lua_State * L, char **runcmd)
{
unsigned int i, j;
- char *s;
+ const char *s;
char **cmdline = NULL;
*runcmd = NULL;
@@ -322,7 +322,7 @@ static char **do_flatten_command(lua_State * L, char **runcmd)
for (i = 1; i <= j; i++) {
cmdline[i] = NULL;
lua_rawgeti(L, -1, i);
- if (lua_isnil(L, -1) || (s = (char *) lua_tostring(L, -1)) == NULL) {
+ if (lua_isnil(L, -1) || (s = lua_tostring(L, -1)) == NULL) {
lua_pop(L, 1);
if (i == 1) {
xfree(cmdline);
@@ -338,7 +338,7 @@ static char **do_flatten_command(lua_State * L, char **runcmd)
cmdline[i] = NULL;
lua_rawgeti(L, -1, 0);
- if (lua_isnil(L, -1) || (s = (char *) lua_tostring(L, -1)) == NULL) {
+ if (lua_isnil(L, -1) || (s = lua_tostring(L, -1)) == NULL) {
*runcmd = cmdline[0];
} else {
*runcmd = xstrdup(s);
@@ -352,7 +352,8 @@ static char **do_flatten_command(lua_State * L, char **runcmd)
static int os_exec(lua_State * L)
{
int allow = 0;
- char *maincmd = NULL, *runcmd = NULL;
+ const char *maincmd = NULL;
+ char *runcmd = NULL;
char *safecmd = NULL, *cmdname = NULL;
char **cmdline = NULL;
@@ -367,7 +368,7 @@ static int os_exec(lua_State * L)
return 2;
}
if (lua_type(L, 1) == LUA_TSTRING) {
- maincmd = (char *) lua_tostring(L, 1);
+ maincmd = lua_tostring(L, 1);
cmdline = do_split_command(maincmd);
runcmd = cmdline[0];
} else if (lua_type(L, 1) == LUA_TTABLE) {
@@ -430,7 +431,8 @@ static int os_exec(lua_State * L)
static int os_spawn(lua_State * L)
{
int allow = 0;
- char *maincmd = NULL, *runcmd = NULL;
+ const char *maincmd = NULL;
+ char *runcmd = NULL;
char *safecmd = NULL, *cmdname = NULL;
char **cmdline = NULL;
int i;
@@ -446,7 +448,7 @@ static int os_spawn(lua_State * L)
return 2;
}
if (lua_type(L, 1) == LUA_TSTRING) {
- maincmd = (char *) lua_tostring(L, 1);
+ maincmd = lua_tostring(L, 1);
cmdline = do_split_command(maincmd);
runcmd = cmdline[0];
} else if (lua_type(L, 1) == LUA_TTABLE) {
@@ -516,9 +518,10 @@ static int os_spawn(lua_State * L)
static int os_setenv(lua_State * L)
{
- char *value, *key, *val;
- key = (char *) luaL_optstring(L, 1, NULL);
- val = (char *) luaL_optstring(L, 2, NULL);
+ char *value;
+ const char *key, *val;
+ key = luaL_optstring(L, 1, NULL);
+ val = luaL_optstring(L, 2, NULL);
if (key) {
if (val) {
value = xmalloc(strlen(key) + strlen(val) + 2);
@@ -543,7 +546,7 @@ static int os_setenv(lua_State * L)
}
-void find_env(lua_State * L)
+static void find_env(lua_State * L)
{
char *envitem, *envitem_orig;
char *envkey;
@@ -854,7 +857,7 @@ static char *do_mkdtemp(char *tmpl)
static int os_tmpdir(lua_State * L)
{
char *s, *tempdir;
- char *tmp = (char *) luaL_optstring(L, 1, "luatex.XXXXXX");
+ const char *tmp = luaL_optstring(L, 1, "luatex.XXXXXX");
if (tmp == NULL ||
strlen(tmp) < 6 || (strcmp(tmp + strlen(tmp) - 6, "XXXXXX") != 0)) {
lua_pushnil(L);
diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c
index 4592df64e3d..6de1ae112a9 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c
@@ -40,7 +40,7 @@ static int findcurh(lua_State * L)
return 1;
}
-int luapdfprint(lua_State * L)
+static int luapdfprint(lua_State * L)
{
int n;
unsigned i;
@@ -58,7 +58,7 @@ int luapdfprint(lua_State * L)
lua_pushstring(L, "invalid argument for print literal mode");
lua_error(L);
} else {
- outputstr = (char *) lua_tostring(L, -2);
+ outputstr = lua_tostring(L, -2);
if (strcmp(outputstr, "direct") == 0)
literal_mode = direct_always;
else if (strcmp(outputstr, "page") == 0)
@@ -123,9 +123,9 @@ static int l_immediateobj(lua_State * L)
static int getpdf(lua_State * L)
{
- char *st;
+ const char *st;
if (lua_isstring(L, 2)) {
- st = (char *) lua_tostring(L, 2);
+ st = lua_tostring(L, 2);
if (st && *st) {
if (*st == 'h')
return findcurh(L);
diff --git a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c
index efc4a2e8e96..f3866f4878f 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lstatslib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lstatslib.c
@@ -32,16 +32,16 @@ typedef struct statistic {
extern void lua_nodelib_push_fast(lua_State * L, halfword n);
-typedef char *(*charfunc) (void);
+typedef const char *(*charfunc) (void);
typedef integer(*intfunc) (void);
-char *getbanner(void)
+static const char *getbanner(void)
{
return ptexbanner;
}
/* hack, I really should implement the makecstring */
-char *getfilename(void)
+static char *getfilename(void)
{
integer t;
t = get_current_name();
@@ -51,12 +51,12 @@ char *getfilename(void)
return xstrdup("");
}
-char *getlasterror(void)
+static char *getlasterror(void)
{
return makecstring(last_error);
}
-char *luatexrevision(void)
+static char *luatexrevision(void)
{
return makecstring(get_luatexrevision());
}
@@ -144,7 +144,7 @@ static struct statistic stats[] = {
};
-static int stats_name_to_id(char *name)
+static int stats_name_to_id(const char *name)
{
int i;
for (i = 0; stats[i].name != NULL; i++) {
@@ -157,7 +157,7 @@ static int stats_name_to_id(char *name)
static int do_getstat(lua_State * L, int i)
{
int t;
- char *st;
+ const char *st;
charfunc f;
intfunc g;
int str;
@@ -204,10 +204,10 @@ static int do_getstat(lua_State * L, int i)
static int getstats(lua_State * L)
{
- char *st;
+ const char *st;
int i;
if (lua_isstring(L, -1)) {
- st = (char *) lua_tostring(L, -1);
+ st = lua_tostring(L, -1);
i = stats_name_to_id(st);
if (i > 0) {
return do_getstat(L, i);
diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c b/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c
index 2ec99e6f6c5..458b4e240bc 100644
--- a/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/ltexiolib.c
@@ -31,7 +31,7 @@ static boolean get_selector_value(lua_State * L, int i, char *l)
{
boolean r = false;
if (lua_isstring(L, i)) {
- char *s = (char *) lua_tostring(L, i);
+ const char *s = lua_tostring(L, i);
if (strcmp(s, "log") == 0) {
*l = log_only;
r = true;
@@ -52,7 +52,7 @@ static boolean get_selector_value(lua_State * L, int i, char *l)
static int do_texio_print(lua_State * L, texio_printer printfunction)
{
str_number texs;
- char *s;
+ const char *s;
size_t k;
int i = 1;
str_number u = 0;
@@ -75,7 +75,7 @@ static int do_texio_print(lua_State * L, texio_printer printfunction)
u = make_string();
for (; i <= n; i++) {
if (lua_isstring(L, i)) {
- s = (char *) lua_tolstring(L, i, &k);
+ s = lua_tolstring(L, i, &k);
texs = maketexlstring(s, k);
printfunction(texs);
flush_str(texs);
@@ -90,9 +90,9 @@ static int do_texio_print(lua_State * L, texio_printer printfunction)
return 0;
}
-static void do_texio_ini_print(lua_State * L, char *extra)
+static void do_texio_ini_print(lua_State * L, const char *extra)
{
- char *s;
+ const char *s;
int i = 1;
char l = term_and_log;
int n = lua_gettop(L);
@@ -102,7 +102,7 @@ static void do_texio_ini_print(lua_State * L, char *extra)
}
for (; i <= n; i++) {
if (lua_isstring(L, i)) {
- s = (char *) lua_tostring(L, i);
+ s = lua_tostring(L, i);
if (l == term_and_log || l == term_only)
fprintf(stdout, "%s%s", extra, s);
if (l == log_only || l == term_and_log) {
diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
index b853515702e..8d64219dae2 100644
--- a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
@@ -55,10 +55,11 @@ static int spindle_index = 0;
static void luac_store(lua_State * L, int i, int partial, integer cattable)
{
- char *st, *sttemp;
+ char *st;
+ const char *sttemp;
size_t tsize;
rope *rn = NULL;
- sttemp = (char *) lua_tolstring(L, i, &tsize);
+ sttemp = lua_tolstring(L, i, &tsize);
st = xmalloc((tsize + 1));
memcpy(st, sttemp, (tsize + 1));
if (st) {
@@ -115,17 +116,17 @@ static int do_luacprint(lua_State * L, int partial, int deftable)
return 0;
}
-int luacwrite(lua_State * L)
+static int luacwrite(lua_State * L)
{
return do_luacprint(L, FULL_LINE, NO_CAT_TABLE);
}
-int luacprint(lua_State * L)
+static int luacprint(lua_State * L)
{
return do_luacprint(L, FULL_LINE, DEFAULT_CAT_TABLE);
}
-int luacsprint(lua_State * L)
+static int luacsprint(lua_State * L)
{
return do_luacprint(L, PARTIAL_LINE, DEFAULT_CAT_TABLE);
}
@@ -233,7 +234,7 @@ void luacstring_close(int n)
lua_error(L); }
-int dimen_to_number(lua_State * L, char *s)
+int dimen_to_number(lua_State * L, const char *s)
{
double v;
char *d;
@@ -270,14 +271,14 @@ int dimen_to_number(lua_State * L, char *s)
}
-integer get_item_index(lua_State * L, int i, integer base)
+static integer get_item_index(lua_State * L, int i, integer base)
{
size_t kk;
integer k;
int cur_cs;
- char *s;
+ const char *s;
if (lua_type(L, i) == LUA_TSTRING) {
- s = (char *) lua_tolstring(L, i, &kk);
+ s = lua_tolstring(L, i, &kk);
cur_cs = string_lookup(s, kk);
if (cur_cs == static_undefined_control_sequence ||
is_undefined_cs(cur_cs)) {
@@ -304,7 +305,7 @@ static int vsetdimen(lua_State * L, int is_global)
/* find the value */
if (!lua_isnumber(L, i))
if (lua_isstring(L, i)) {
- j = dimen_to_number(L, (char *) lua_tostring(L, i));
+ j = dimen_to_number(L, lua_tostring(L, i));
} else {
lua_pushstring(L, "unsupported value type");
lua_error(L);
@@ -326,7 +327,7 @@ static int setdimen(lua_State * L)
int isglobal = 0;
int n = lua_gettop(L);
if (n == 3 && lua_isstring(L, 1)) {
- char *s = (char *) lua_tostring(L, 1);
+ const char *s = lua_tostring(L, 1);
if (strcmp(s, "global") == 0)
isglobal = 1;
}
@@ -370,14 +371,14 @@ static int setskip(lua_State * L)
int isglobal = 0;
int n = lua_gettop(L);
if (n == 3 && lua_isstring(L, 1)) {
- char *s = (char *) lua_tostring(L, 1);
+ const char *s = lua_tostring(L, 1);
if (strcmp(s, "global") == 0)
isglobal = 1;
}
return vsetskip(L, isglobal);
}
-int getskip(lua_State * L)
+static int getskip(lua_State * L)
{
halfword j;
integer k;
@@ -415,7 +416,7 @@ static int setcount(lua_State * L)
int isglobal = 0;
int n = lua_gettop(L);
if (n == 3 && lua_isstring(L, 1)) {
- char *s = (char *) lua_tostring(L, 1);
+ const char *s = lua_tostring(L, 1);
if (strcmp(s, "global") == 0)
isglobal = 1;
}
@@ -459,7 +460,7 @@ static int setattribute(lua_State * L)
int isglobal = 0;
int n = lua_gettop(L);
if (n == 3 && lua_isstring(L, 1)) {
- char *s = (char *) lua_tostring(L, 1);
+ const char *s = lua_tostring(L, 1);
if (strcmp(s, "global") == 0)
isglobal = 1;
}
@@ -477,12 +478,12 @@ static int getattribute(lua_State * L)
return 1;
}
-int vsettoks(lua_State * L, int is_global)
+static int vsettoks(lua_State * L, int is_global)
{
int i, j, err;
size_t len;
integer k;
- char *st;
+ const char *st;
integer save_global_defs = int_par(param_global_defs_code);
if (is_global)
int_par(param_global_defs_code) = 1;
@@ -491,7 +492,7 @@ int vsettoks(lua_State * L, int is_global)
lua_pushstring(L, "unsupported value type");
lua_error(L);
}
- st = (char *) lua_tolstring(L, i, &len);
+ st = lua_tolstring(L, i, &len);
k = get_item_index(L, (i - 1), get_toks_base());
check_index_range(k, "settoks");
j = maketexlstring(st, len);
@@ -510,7 +511,7 @@ static int settoks(lua_State * L)
int isglobal = 0;
int n = lua_gettop(L);
if (n == 3 && lua_isstring(L, 1)) {
- char *s = (char *) lua_tostring(L, 1);
+ const char *s = lua_tostring(L, 1);
if (strcmp(s, "global") == 0)
isglobal = 1;
}
@@ -531,12 +532,12 @@ static int gettoks(lua_State * L)
static int get_box_id(lua_State * L, int i)
{
- char *s;
+ const char *s;
integer cur_cs, cur_cmd;
size_t k = 0;
int j = -1;
if (lua_type(L, i) == LUA_TSTRING) {
- s = (char *) lua_tolstring(L, i, &k);
+ s = lua_tolstring(L, i, &k);
cur_cs = string_lookup(s, k);
cur_cmd = zget_eq_type(cur_cs);
if (cur_cmd == char_given_cmd ||
@@ -591,7 +592,7 @@ static int setbox(lua_State * L)
int isglobal = 0;
int n = lua_gettop(L);
if (n == 3 && lua_isstring(L, 1)) {
- char *s = (char *) lua_tostring(L, 1);
+ const char *s = lua_tostring(L, 1);
if (strcmp(s, "global") == 0)
isglobal = 1;
}
@@ -621,17 +622,17 @@ static int getboxdim(lua_State * L, int whichdim)
return 1;
}
-int getboxwd(lua_State * L)
+static int getboxwd(lua_State * L)
{
return getboxdim(L, width_offset);
}
-int getboxht(lua_State * L)
+static int getboxht(lua_State * L)
{
return getboxdim(L, height_offset);
}
-int getboxdp(lua_State * L)
+static int getboxdp(lua_State * L)
{
return getboxdim(L, depth_offset);
}
@@ -644,7 +645,7 @@ static int vsetboxdim(lua_State * L, int whichdim, int is_global)
int_par(param_global_defs_code) = 1;
i = lua_gettop(L);
if (!lua_isnumber(L, i)) {
- j = dimen_to_number(L, (char *) lua_tostring(L, i));
+ j = dimen_to_number(L, lua_tostring(L, i));
} else {
j = (int) lua_tonumber(L, i);
}
@@ -678,7 +679,7 @@ static int setboxwd(lua_State * L)
int isglobal = 0;
int n = lua_gettop(L);
if (n == 3 && lua_isstring(L, 1)) {
- char *s = (char *) lua_tostring(L, 1);
+ const char *s = lua_tostring(L, 1);
if (strcmp(s, "global") == 0)
isglobal = 1;
}
@@ -690,7 +691,7 @@ static int setboxht(lua_State * L)
int isglobal = 0;
int n = lua_gettop(L);
if (n == 3 && lua_isstring(L, 1)) {
- char *s = (char *) lua_tostring(L, 1);
+ const char *s = lua_tostring(L, 1);
if (strcmp(s, "global") == 0)
isglobal = 1;
}
@@ -702,16 +703,16 @@ static int setboxdp(lua_State * L)
int isglobal = 0;
int n = lua_gettop(L);
if (n == 3 && lua_isstring(L, 1)) {
- char *s = (char *) lua_tostring(L, 1);
+ const char *s = lua_tostring(L, 1);
if (strcmp(s, "global") == 0)
isglobal = 1;
}
return vsetboxdim(L, depth_offset, isglobal);
}
-int settex(lua_State * L)
+static int settex(lua_State * L)
{
- char *st;
+ const char *st;
int i, j, texstr;
size_t k;
int cur_cs, cur_cmd;
@@ -719,11 +720,11 @@ int settex(lua_State * L)
j = 0;
i = lua_gettop(L);
if (lua_isstring(L, (i - 1))) {
- st = (char *) lua_tolstring(L, (i - 1), &k);
+ st = lua_tolstring(L, (i - 1), &k);
texstr = maketexlstring(st, k);
if (is_primitive(texstr)) {
if (i == 3 && lua_isstring(L, 1)) {
- char *s = (char *) lua_tostring(L, 1);
+ const char *s = lua_tostring(L, 1);
if (strcmp(s, "global") == 0)
isglobal = 1;
}
@@ -742,7 +743,7 @@ int settex(lua_State * L)
} else if (is_dim_assign(cur_cmd)) {
if (!lua_isnumber(L, i)) {
if (lua_isstring(L, i)) {
- j = dimen_to_number(L, (char *) lua_tostring(L, i));
+ j = dimen_to_number(L, lua_tostring(L, i));
} else {
lua_pushstring(L, "unsupported value type");
lua_error(L);
@@ -765,7 +766,8 @@ int settex(lua_State * L)
return 0;
}
-char *get_something_internal(int cur_cmd, int cur_code)
+#if 0 /* unused */
+static char *get_something_internal(int cur_cmd, int cur_code)
{
int texstr;
char *str;
@@ -780,8 +782,9 @@ char *get_something_internal(int cur_cmd, int cur_code)
flush_str(texstr);
return str;
}
+#endif
-int do_convert(lua_State * L, int cur_code)
+static int do_convert(lua_State * L, int cur_code)
{
int texstr;
integer i = -1;
@@ -830,7 +833,7 @@ int do_convert(lua_State * L, int cur_code)
}
-int do_scan_internal(lua_State * L, int cur_cmd, int cur_code)
+static int do_scan_internal(lua_State * L, int cur_cmd, int cur_code)
{
int texstr;
char *str = NULL;
@@ -858,7 +861,7 @@ int do_scan_internal(lua_State * L, int cur_cmd, int cur_code)
return 1;
}
-int do_lastitem(lua_State * L, int cur_code)
+static int do_lastitem(lua_State * L, int cur_code)
{
int retval = 1;
switch (cur_code) {
@@ -945,7 +948,7 @@ static int tex_setmathparm(lua_State * L)
if ((n == 3) || (n == 4)) {
if (n == 4 && lua_isstring(L, 1)) {
- char *s = (char *) lua_tostring(L, 1);
+ const char *s = lua_tostring(L, 1);
if (strcmp(s, "global") == 0)
l = 1;
}
@@ -1021,7 +1024,7 @@ static int getpdfxformname(lua_State * L)
}
-int get_parshape(lua_State * L)
+static int get_parshape(lua_State * L)
{
int n;
halfword par_shape_ptr = get_par_shape_ptr();
@@ -1045,7 +1048,7 @@ int get_parshape(lua_State * L)
}
-int gettex(lua_State * L)
+static int gettex(lua_State * L)
{
int cur_cs = -1;
int retval = 1; /* default is to return nil */
@@ -1053,7 +1056,7 @@ int gettex(lua_State * L)
if (lua_isstring(L, 2)) { /* 1 == 'tex' */
int texstr;
size_t k;
- char *st = (char *) lua_tolstring(L, 2, &k);
+ const char *st = lua_tolstring(L, 2, &k);
texstr = maketexlstring(st, k);
cur_cs = prim_lookup(texstr); /* not found == relax == 0 */
flush_str(texstr);
@@ -1099,11 +1102,11 @@ int gettex(lua_State * L)
}
-int getlist(lua_State * L)
+static int getlist(lua_State * L)
{
- char *str;
+ const char *str;
if (lua_isstring(L, 2)) {
- str = (char *) lua_tostring(L, 2);
+ str = lua_tostring(L, 2);
if (strcmp(str, "page_ins_head") == 0) {
if (vlink(page_ins_head) == page_ins_head)
lua_pushnumber(L, null);
@@ -1147,13 +1150,13 @@ int getlist(lua_State * L)
return 1;
}
-int setlist(lua_State * L)
+static int setlist(lua_State * L)
{
halfword *n_ptr;
- char *str;
+ const char *str;
halfword n = 0;
if (lua_isstring(L, 2)) {
- str = (char *) lua_tostring(L, 2);
+ str = lua_tostring(L, 2);
if (strcmp(str, "best_size") == 0) {
best_size = lua_tointeger(L, 3);
} else if (strcmp(str, "least_page_cost") == 0) {
@@ -1207,7 +1210,7 @@ int setlist(lua_State * L)
static int do_integer_error(double m)
{
- char *help[] = { "I can only go up to 2147483647='17777777777=" "7FFFFFFF,",
+ const char *help[] = { "I can only go up to 2147483647='17777777777=" "7FFFFFFF,",
"so I'm using that number instead of yours.",
NULL
};
@@ -1261,14 +1264,14 @@ static int tex_scaletable(lua_State * L)
static int tex_definefont(lua_State * L)
{
- char *csname;
+ const char *csname;
int f, u;
str_number t;
size_t l;
int i = 1;
int a = 0;
if (!no_new_control_sequence) {
- char *help[] =
+ const char *help[] =
{ "You can't create a new font inside a \\csname\\endcsname pair",
NULL
};
@@ -1278,7 +1281,7 @@ static int tex_definefont(lua_State * L)
a = lua_toboolean(L, 1);
i = 2;
}
- csname = (char *) luaL_checklstring(L, i, &l);
+ csname = luaL_checklstring(L, i, &l);
f = luaL_checkinteger(L, (i + 1));
t = maketexlstring(csname, l);
no_new_control_sequence = 0;
@@ -1347,7 +1350,7 @@ static int tex_extraprimitives(lua_State * L)
} else {
for (i = 1; i <= n; i++) {
if (lua_isstring(L, i)) {
- char *s = (char *) lua_tostring(L, i);
+ const char *s = lua_tostring(L, i);
if (strcmp(s, "etex") == 0) {
mask |= etex_command;
} else if (strcmp(s, "tex") == 0) {
@@ -1390,7 +1393,7 @@ static int tex_enableprimitives(lua_State * L)
} else {
size_t l;
int i;
- char *pre = (char *) luaL_checklstring(L, 1, &l);
+ const char *pre = luaL_checklstring(L, 1, &l);
if (lua_istable(L, 2)) {
int nncs = no_new_control_sequence;
no_new_control_sequence = true;
@@ -1398,7 +1401,7 @@ static int tex_enableprimitives(lua_State * L)
while (1) {
lua_rawgeti(L, 2, i);
if (lua_isstring(L, 3)) {
- char *prim = (char *) lua_tostring(L, 3);
+ const char *prim = lua_tostring(L, 3);
str_number s = maketexstring(prim);
halfword prim_val = prim_lookup(s);
if (prim_val != undefined_primitive) {
diff --git a/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c b/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c
index 947c6ceab8c..1ba1e609aef 100644
--- a/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/ltokenlib.c
@@ -24,8 +24,6 @@
static const char _svn_version[] =
"$Id: ltokenlib.c 2448 2009-06-08 07:43:50Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.40.6/source/texk/web2c/luatexdir/lua/ltokenlib.c $";
-extern int get_command_id(char *);
-
static int max_command = 0;
static int null_cs = 0;
@@ -46,7 +44,7 @@ static int test_expandable(lua_State * L)
if (lua_isnumber(L, -1)) {
cmd = lua_tointeger(L, -1);
} else if (lua_isstring(L, -1)) {
- cmd = get_command_id((char *) lua_tostring(L, -1));
+ cmd = get_command_id(lua_tostring(L, -1));
}
if (cmd > max_command) {
lua_pushboolean(L, 1);
@@ -68,7 +66,7 @@ static int test_protected(lua_State * L)
if (lua_isnumber(L, -1)) {
chr = lua_tointeger(L, -1);
} else if (lua_isstring(L, -1)) {
- chr = get_command_id((char *) lua_tostring(L, -1));
+ chr = get_command_id(lua_tostring(L, -1));
}
if (fixmem[fixmem[chr].hhrh].hhlh == protected_token) {
lua_pushboolean(L, 1);
@@ -160,7 +158,7 @@ static int run_get_command_id(lua_State * L)
{
int cs = -1;
if (lua_isstring(L, -1)) {
- cs = get_command_id((char *) lua_tostring(L, -1));
+ cs = get_command_id(lua_tostring(L, -1));
}
lua_pushnumber(L, cs);
return 1;
@@ -169,10 +167,10 @@ static int run_get_command_id(lua_State * L)
static int run_get_csname_id(lua_State * L)
{
- char *s;
+ const char *s;
size_t k, cs = 0;
if (lua_isstring(L, -1)) {
- s = (char *) lua_tolstring(L, -1, &k);
+ s = lua_tolstring(L, -1, &k);
cs = string_lookup(s, k);
}
lua_pushnumber(L, cs);
@@ -212,12 +210,12 @@ static int run_expand(lua_State * L)
static int run_lookup(lua_State * L)
{
- char *s;
+ const char *s;
size_t l;
integer cs, cmd, chr;
int save_nncs;
if (lua_isstring(L, -1)) {
- s = (char *) lua_tolstring(L, -1, &l);
+ s = lua_tolstring(L, -1, &l);
if (l > 0) {
save_nncs = no_new_control_sequence;
no_new_control_sequence = true;
diff --git a/Build/source/texk/web2c/luatexdir/lua/luainit.c b/Build/source/texk/web2c/luatexdir/lua/luainit.c
index 2f7f3bc5ccb..baa40d3cfe9 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luainit.c
+++ b/Build/source/texk/web2c/luatexdir/lua/luainit.c
@@ -77,7 +77,7 @@ const_string LUATEX_IHELP[] = {
NULL
};
-char *ex_selfdir(char *argv0)
+static char *ex_selfdir(char *argv0)
{
#if defined(WIN32)
char short_path[PATH_MAX], path[PATH_MAX], *fp;
@@ -119,7 +119,7 @@ prepare_cmdline(lua_State * L, char **argv, int argc, int zero_offset)
return;
}
-string input_name = NULL;
+const_string input_name = NULL;
static const_string user_progname = NULL;
@@ -129,7 +129,7 @@ extern int program_name_set; /* in lkpselib.c */
extern char **argv;
extern int argc;
-char *startup_filename = NULL;
+const char *startup_filename = NULL;
int lua_only = 0;
int lua_offset = 0;
@@ -378,7 +378,7 @@ static void parse_options(int argc, char **argv)
#define is_readable(a) (stat(a,&finfo)==0) && S_ISREG(finfo.st_mode) && \
(f=fopen(a,"r")) != NULL && !fclose(f)
-char *find_filename(char *name, char *envkey)
+static const char *find_filename(const char *name, const char *envkey)
{
struct stat finfo;
char *dirname = NULL;
@@ -406,7 +406,7 @@ char *find_filename(char *name, char *envkey)
}
-char *cleaned_invocation_name(char *arg)
+static char *cleaned_invocation_name(char *arg)
{
char *ret, *dot;
const char *start = xbasename(arg);
@@ -418,7 +418,7 @@ char *cleaned_invocation_name(char *arg)
return ret;
}
-void init_kpse(void)
+static void init_kpse(void)
{
if (!user_progname) {
@@ -447,7 +447,7 @@ void init_kpse(void)
program_name_set = 1;
}
-void fix_dumpname(void)
+static void fix_dumpname(void)
{
int dist;
if (dump_name) {
@@ -474,6 +474,11 @@ void lua_initialize(int ac, char **av)
int pdf_table_id;
int token_table_id;
int node_table_id;
+ /* Non-const initialized variables for putenv(). */
+ static char LC_CTYPE_C[] = "LC_CTYPE=C";
+ static char LC_COLLATE_C[] = "LC_COLLATE=C";
+ static char LC_NUMERIC_C[] = "LC_NUMERIC=C";
+ static char engine_luatex[] = "engine=luatex";
/* Save to pass along to topenin. */
argc = ac;
argv = av;
@@ -507,12 +512,12 @@ void lua_initialize(int ac, char **av)
shellenabledp = true;
/* make sure that the locale is 'sane' (for lua) */
- putenv("LC_CTYPE=C");
- putenv("LC_COLLATE=C");
- putenv("LC_NUMERIC=C");
+ putenv(LC_CTYPE_C);
+ putenv(LC_COLLATE_C);
+ putenv(LC_NUMERIC_C);
/* this is sometimes needed */
- putenv("engine=luatex");
+ putenv(engine_luatex);
luainterpreter();
@@ -524,7 +529,7 @@ void lua_initialize(int ac, char **av)
}
/* now run the file */
if (startup_filename != NULL) {
- char *v1;
+ const char *v1;
/* hide the 'tex' and 'pdf' table */
tex_table_id = hide_lua_table(Luas, "tex");
token_table_id = hide_lua_table(Luas, "token");
@@ -544,9 +549,7 @@ void lua_initialize(int ac, char **av)
get_lua_string("texconfig", "jobname", &input_name);
}
if (!dump_name) {
- string temp;
- get_lua_string("texconfig", "formatname", &temp);
- dump_name = temp;
+ get_lua_string("texconfig", "formatname", &dump_name);
}
if ((lua_only) || ((!input_name) && (!dump_name))) {
if (given_file)
@@ -641,7 +644,7 @@ void check_texconfig_init(void)
}
}
-void write_svnversion(char *v)
+void write_svnversion(const char *v)
{
char *a_head, *n;
char *a = strdup(v);
diff --git a/Build/source/texk/web2c/luatexdir/lua/luanode.c b/Build/source/texk/web2c/luatexdir/lua/luanode.c
index b35ca96c028..a9daa106920 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luanode.c
+++ b/Build/source/texk/web2c/luatexdir/lua/luanode.c
@@ -28,7 +28,7 @@ static const char _svn_version[] =
#define info(a) fixmem[(a)].hhlh
#define link(a) fixmem[(a)].hhrh
-static char *group_code_names[] = {
+static const char *group_code_names[] = {
"",
"simple",
"hbox",
@@ -54,10 +54,10 @@ static char *group_code_names[] = {
"fin_row"
};
-char *pack_type_name[] = { "exactly", "additional" };
+static const char *pack_type_name[] = { "exactly", "additional" };
-void lua_node_filter_s(int filterid, char *extrainfo)
+void lua_node_filter_s(int filterid, const char *extrainfo)
{
lua_State *L = Luas;
int s_top = lua_gettop(L);
@@ -86,7 +86,7 @@ lua_node_filter(int filterid, int xextrainfo, halfword head_node,
halfword ret;
int a;
lua_State *L = Luas;
- char *extrainfo = group_code_names[xextrainfo];
+ const char *extrainfo = group_code_names[xextrainfo];
int callback_id = callback_defined(filterid);
if (head_node == null || vlink(head_node) == null || callback_id <= 0)
return;
@@ -269,10 +269,10 @@ int visible_last_node_type(int n)
void lua_pdf_literal(int i)
{
- char *s = NULL;
+ const char *s;
size_t l = 0;
lua_rawgeti(Luas, LUA_REGISTRYINDEX, i);
- s = (char *) lua_tolstring(Luas, -1, &l);
+ s = lua_tolstring(Luas, -1, &l);
while (l--) {
pdf_room(1);
pdf_buf[pdf_ptr++] = *s++;
@@ -324,7 +324,7 @@ void show_pdf_literal(pointer p)
print_mark(pdf_literal_data(p));
} else {
lua_rawgeti(Luas, LUA_REGISTRYINDEX, pdf_literal_data(p));
- tprint((char *) lua_tostring(Luas, -1));
+ tprint(lua_tostring(Luas, -1));
lua_pop(Luas, 1);
}
}
diff --git a/Build/source/texk/web2c/luatexdir/lua/luastuff.c b/Build/source/texk/web2c/luatexdir/lua/luastuff.c
index bcd64389856..44148f30928 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luastuff.c
+++ b/Build/source/texk/web2c/luatexdir/lua/luastuff.c
@@ -25,7 +25,7 @@ static const char _svn_version[] =
lua_State *Luas = NULL;
-extern char *startup_filename;
+extern const char *startup_filename;
extern int safer_option;
extern int nosocket_option;
@@ -33,7 +33,7 @@ int luastate_bytes = 0;
int lua_active = 0;
-void make_table(lua_State * L, char *tab, char *getfunc, char *setfunc)
+void make_table(lua_State * L, const char *tab, const char *getfunc, const char *setfunc)
{
/* make the table *//* [{<tex>}] */
lua_pushstring(L, tab); /* [{<tex>},"dimen"] */
@@ -68,7 +68,7 @@ const char *getS(lua_State * L, void *ud, size_t * size)
return ls->s;
}
-void *my_luaalloc(void *ud, void *ptr, size_t osize, size_t nsize)
+static void *my_luaalloc(void *ud, void *ptr, size_t osize, size_t nsize)
{
void *ret = NULL;
(void) ud; /* for -Wunused */
@@ -213,7 +213,7 @@ void luainterpreter(void)
Luas = L;
}
-int hide_lua_table(lua_State * L, char *name)
+int hide_lua_table(lua_State * L, const char *name)
{
int r = 0;
lua_getglobal(L, name);
@@ -225,14 +225,14 @@ int hide_lua_table(lua_State * L, char *name)
return r;
}
-void unhide_lua_table(lua_State * L, char *name, int r)
+void unhide_lua_table(lua_State * L, const char *name, int r)
{
lua_rawgeti(L, LUA_REGISTRYINDEX, r);
lua_setglobal(L, name);
luaL_unref(L, LUA_REGISTRYINDEX, r);
}
-int hide_lua_value(lua_State * L, char *name, char *item)
+int hide_lua_value(lua_State * L, const char *name, const char *item)
{
int r = 0;
lua_getglobal(L, name);
@@ -245,7 +245,7 @@ int hide_lua_value(lua_State * L, char *name, char *item)
return r;
}
-void unhide_lua_value(lua_State * L, char *name, char *item, int r)
+void unhide_lua_value(lua_State * L, const char *name, const char *item, int r)
{
lua_getglobal(L, name);
if (lua_istable(L, -1)) {
diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex.c b/Build/source/texk/web2c/luatexdir/lua/luatex.c
index d2e8d88a839..4db4660540e 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luatex.c
+++ b/Build/source/texk/web2c/luatexdir/lua/luatex.c
@@ -331,7 +331,7 @@ void zwclose(FILE * f)
/* create the dvi or pdf file */
-int open_outfile(FILE ** f, char *name, char *mode)
+int open_outfile(FILE ** f, const char *name, const char *mode)
{
FILE *res;
res = fopen(name, mode);
diff --git a/Build/source/texk/web2c/luatexdir/lua/luatoken.c b/Build/source/texk/web2c/luatexdir/lua/luatoken.c
index bc1af10a3f6..628dbf21478 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luatoken.c
+++ b/Build/source/texk/web2c/luatexdir/lua/luatoken.c
@@ -177,7 +177,7 @@ command_item command_names[] = {
};
-int get_command_id(char *s)
+int get_command_id(const char *s)
{
int i;
int cmd = -1;
@@ -242,7 +242,7 @@ static int token_from_lua(lua_State * L)
static int get_cur_cs(lua_State * L)
{
- char *s;
+ const char *s;
unsigned j;
size_t l;
integer cs;
@@ -252,7 +252,7 @@ static int get_cur_cs(lua_State * L)
cur_cs = 0;
lua_getfield(L, -1, "name");
if (lua_isstring(L, -1)) {
- s = (char *) lua_tolstring(L, -1, &l);
+ s = lua_tolstring(L, -1, &l);
if (l > 0) {
if ((int) (last + l) > buf_size)
check_buffer_overflow(last + l);
@@ -307,7 +307,7 @@ static int get_cur_cs(lua_State * L)
#define Print_esc(b) { \
- char *v = b; \
+ const char *v = b; \
if (e>0 && e<string_offset) { \
Print_uchar (e); Print_uchar (e); \
} \
@@ -501,7 +501,7 @@ void tokenlist_to_luastring(lua_State * L, int p)
int tokenlist_from_lua(lua_State * L)
{
- char *s;
+ const char *s;
int tok;
size_t i, j;
halfword p, q, r;
@@ -523,7 +523,7 @@ int tokenlist_from_lua(lua_State * L)
}
return r;
} else if (lua_isstring(L, -1)) {
- s = (char *) lua_tolstring(L, -1, &j);
+ s = lua_tolstring(L, -1, &j);
for (i = 0; i < j; i++) {
if (s[i] == 32) {
tok = (10 * string_offset) + s[i];
@@ -549,7 +549,7 @@ void do_get_token_lua(integer callback_id)
break;
}
if (lua_pcall(L, 0, 1, 0) != 0) { /* no arg, 1 result */
- tex_error((char *) lua_tostring(L, -1), NULL);
+ tex_error(lua_tostring(L, -1), NULL);
lua_pop(L, 2); /* container and result */
break;
}
diff --git a/Build/source/texk/web2c/luatexdir/lua/texluac.c b/Build/source/texk/web2c/luatexdir/lua/texluac.c
index de4a2ae753d..c994785bd08 100644
--- a/Build/source/texk/web2c/luatexdir/lua/texluac.c
+++ b/Build/source/texk/web2c/luatexdir/lua/texluac.c
@@ -45,6 +45,8 @@
#include <../lua51/lstring.h>
#include <../lua51/lundump.h>
+#include "luatex-api.h"
+
static const char _svn_version[] =
"$Id: texluac.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.40.6/source/texk/web2c/luatexdir/lua/texluac.c $";