diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2015-07-02 08:13:03 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2015-07-02 08:13:03 +0000 |
commit | 259d9c46b0d3fc75257ea21d2aaa26f093263f4c (patch) | |
tree | ceb7e4691d587cc4260cf2b741eba1f775e9a57e /Build/source | |
parent | 2abb6a5abaeda2521b1baa26357b636123755367 (diff) |
MFLua, MFLuaJIT: Use kpse_find_file() to locate .lua files (from Akira)
git-svn-id: svn://tug.org/texlive/trunk@37732 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/texk/web2c/mfluadir/ChangeLog | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/mfluadir/mfluac.c | 92 | ||||
-rwxr-xr-x | Build/source/texk/web2c/mfluadir/mfluatraptest | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/mfluajitdir/ChangeLog | 4 | ||||
-rwxr-xr-x | Build/source/texk/web2c/mfluajitdir/mfluajittraptest | 6 |
5 files changed, 79 insertions, 37 deletions
diff --git a/Build/source/texk/web2c/mfluadir/ChangeLog b/Build/source/texk/web2c/mfluadir/ChangeLog index c99506bdbbb..8a54f22f98e 100644 --- a/Build/source/texk/web2c/mfluadir/ChangeLog +++ b/Build/source/texk/web2c/mfluadir/ChangeLog @@ -1,3 +1,11 @@ +2015-07-02 Peter Breitenlohner <peb@mppmu.mpg.de> + + * mfluatraptest: Directly use mfluatrap/*.lua files. + +2015-07-02 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * mflua.c: Use kpse_find_file() to locate .lua files. + 2015-06-22 Peter Breitenlohner <peb@mppmu.mpg.de> * am/mflua.am: Use $(tie_c) and $(tie_m). diff --git a/Build/source/texk/web2c/mfluadir/mfluac.c b/Build/source/texk/web2c/mfluadir/mfluac.c index 5c1ddd5f66a..044bd05633e 100644 --- a/Build/source/texk/web2c/mfluadir/mfluac.c +++ b/Build/source/texk/web2c/mfluadir/mfluac.c @@ -9,7 +9,7 @@ #include <lua.h> #include <lualib.h> #include <lauxlib.h> - +#include <kpathsea/kpathsea.h> /**************************************************************/ /* */ /* private functions */ @@ -408,12 +408,13 @@ static int priv_mfweb_LUAGLOBALGET_boundary_char(lua_State *L) int mfluabeginprogram(void) { lua_State *L = luaL_newstate(); - const char* luafile = "begin_program.lua"; + char* luafile = kpse_find_file("begin_program.lua", kpse_lua_format, 0); int res ; luaL_openlibs(L); Luas[0] = L; /* execute Lua external "begin_program.lua" */ res = luaL_loadfile(L, luafile); + if(luafile) free(luafile); if ( res==0 ) { res = lua_pcall(L, 0, 0, 0); } @@ -426,8 +427,9 @@ int mfluaendprogram(void) { lua_State *L = Luas[0]; /* execute Lua external "end_program.lua" */ - const char* file = "end_program.lua"; + char* file = kpse_find_file("end_program.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if(file) free(file); if ( res==0 ) { res = lua_pcall(L, 0, 0, 0); } @@ -440,8 +442,9 @@ int mfluaendprogram(void) int mfluaPREstartofMF(void) { lua_State *L = Luas[0]; - const char* file = "start_of_MF.lua"; + char* file = kpse_find_file("start_of_MF.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -473,8 +476,9 @@ int mfluaPREstartofMF(void) int mfluaPREmaincontrol(void) { lua_State *L = Luas[0]; - const char* file = "main_control.lua"; + char* file = kpse_find_file("main_control.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -506,8 +510,9 @@ int mfluaPREmaincontrol(void) int mfluaPOSTmaincontrol(void) { lua_State *L = Luas[0]; - const char* file = "main_control.lua"; + char* file = kpse_find_file("main_control.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -541,7 +546,7 @@ int mfluainitialize(void) { /* execute Lua external "mfluaini.lua" */ lua_State *L = Luas[0]; - const char* file = "mfluaini.lua"; + char* file = kpse_find_file("mfluaini.lua", kpse_lua_format, 0); int res ; /* register lua functions */ lua_pushcfunction(L, priv_mfweb_link);lua_setglobal(L, "link"); @@ -582,6 +587,7 @@ int mfluainitialize(void) /*lua_pushcfunction(L, priv_mfweb_SKELETON);lua_setglobal(L, "SKELETON");*/ /* execute Lua external "mfluaini.lua" */ res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ) { res = lua_pcall(L, 0, 0, 0); } @@ -593,8 +599,9 @@ int mfluainitialize(void) int mfluaPOSTfinalcleanup(void) { lua_State *L = Luas[0]; - const char* file = "final_cleanup.lua"; + char* file = kpse_find_file("final_cleanup.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); /*if (res!=0) {fprintf(stderr,"\n! Warning: file final_cleanup not loaded\n",lua_tostring(L, -1)); return res;}*/ if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); @@ -643,8 +650,9 @@ int mfluaPOSTfinalcleanup(void) /* fprintf(stderr,"\n! %s\n","*end***************"); */ /* lua_State *L = Luas[0]; */ -/* const char* file = "print_path.lua"; */ +/* char* file = kpse_find_file("print_path.lua", kpse_lua_format, 0); */ /* int res = luaL_loadfile(L, file); */ +/* if (file) free (file); */ /* if ( res==0 ) { */ /* res = lua_pcall(L, 0, 0, 0); */ /* } */ @@ -660,8 +668,9 @@ int mfluaPOSTfinalcleanup(void) int mfluaprintpath(halfword h, strnumber s, boolean nuline) { lua_State *L = Luas[0]; - const char* file = "print_path.lua"; + char* file = kpse_find_file("print_path.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -697,8 +706,9 @@ int mfluaprintedges(strnumber s, boolean nuline, integer xoff, integer yoff) { lua_State *L = Luas[0]; - const char* file = "print_edges.lua"; + char* file = kpse_find_file("print_edges.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -735,8 +745,9 @@ int mfluaprintedges(strnumber s, boolean nuline, integer xoff, integer yoff) /* { */ /* lua_State *L = Luas[0]; */ -/* const char* file = "offset_prep.lua"; */ +/* char* file = kpse_find_file("offset_prep.lua",kpse_lua_format, 0); */ /* int res = luaL_loadfile(L, file); */ +/* if (file) free (file); */ /* if ( res==0 ){ */ /* res = lua_pcall(L, 0, 0, 0); */ /* if (res==0){ */ @@ -776,8 +787,9 @@ int mfluaPREoffsetprep(halfword c, halfword h) { lua_State *L = Luas[0]; - const char* file = "offset_prep.lua"; + char* file = kpse_find_file("offset_prep.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -811,8 +823,9 @@ int mfluaPOSToffsetprep(halfword c, halfword h) { lua_State *L = Luas[0]; - const char* file = "offset_prep.lua"; + char* file = kpse_find_file("offset_prep.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -846,8 +859,9 @@ int mfluaPOSToffsetprep(halfword c, halfword h) int mfluaPREfillenveloperhs(halfword rhs) { lua_State *L = Luas[0]; - const char* file = "do_add_to.lua"; + char* file = kpse_find_file("do_add_to.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -879,8 +893,9 @@ int mfluaPREfillenveloperhs(halfword rhs) int mfluaPOSTfillenveloperhs(halfword rhs) { lua_State *L = Luas[0]; - const char* file = "do_add_to.lua"; + char* file = kpse_find_file("do_add_to.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -913,8 +928,9 @@ int mfluaPOSTfillenveloperhs(halfword rhs) int mfluaPREfillenvelopelhs(halfword lhs) { lua_State *L = Luas[0]; - const char* file = "do_add_to.lua"; + char* file = kpse_find_file("do_add_to.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -946,8 +962,9 @@ int mfluaPREfillenvelopelhs(halfword lhs) int mfluaPOSTfillenvelopelhs(halfword lhs) { lua_State *L = Luas[0]; - const char* file = "do_add_to.lua"; + char* file = kpse_find_file("do_add_to.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -980,8 +997,9 @@ int mfluaPOSTfillenvelopelhs(halfword lhs) int mfluaPREfillspecrhs(halfword rhs) { lua_State *L = Luas[0]; - const char* file = "do_add_to.lua"; + char* file = kpse_find_file("do_add_to.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -1013,8 +1031,9 @@ int mfluaPREfillspecrhs(halfword rhs) int mfluaPOSTfillspecrhs(halfword rhs) { lua_State *L = Luas[0]; - const char* file = "do_add_to.lua"; + char* file = kpse_find_file("do_add_to.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -1046,8 +1065,9 @@ int mfluaPOSTfillspecrhs(halfword rhs) int mfluaPREfillspeclhs(halfword lhs) { lua_State *L = Luas[0]; - const char* file = "do_add_to.lua"; + char* file = kpse_find_file("do_add_to.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -1079,8 +1099,9 @@ int mfluaPREfillspeclhs(halfword lhs) int mfluaPOSTfillspeclhs(halfword lhs) { lua_State *L = Luas[0]; - const char* file = "do_add_to.lua"; + char* file = kpse_find_file("do_add_to.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -1111,8 +1132,9 @@ int mfluaPOSTfillspeclhs(halfword lhs) int mfluaPREmovetoedges(halfword lhs) { lua_State *L = Luas[0]; - const char* file = "fill_spec.lua"; + char* file = kpse_find_file("fill_spec.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -1145,8 +1167,9 @@ int mfluaPREmovetoedges(halfword lhs) int mfluaPOSTmovetoedges(halfword lhs) { lua_State *L = Luas[0]; - const char* file = "fill_spec.lua"; + char* file = kpse_find_file("fill_spec.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -1179,8 +1202,9 @@ int mfluaPOSTmovetoedges(halfword lhs) int mfluaPREmakechoices(halfword p) { lua_State *L = Luas[0]; - const char* file = "scan_direction.lua"; + char* file = kpse_find_file("scan_direction.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -1212,8 +1236,9 @@ int mfluaPREmakechoices(halfword p) int mfluaPOSTmakechoices(halfword p) { lua_State *L = Luas[0]; - const char* file = "scan_direction.lua"; + char* file = kpse_find_file("scan_direction.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -1249,8 +1274,9 @@ int mfluaPOSTmakechoices(halfword p) int mfluaprintretrogradeline(integer x0, integer y0, integer cur_x, integer cur_y) { lua_State *L = Luas[0]; - const char* file = "skew_line_edges.lua"; + char* file = kpse_find_file("skew_line_edges.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -1286,8 +1312,9 @@ int mfluaprintretrogradeline(integer x0, integer y0, integer cur_x, integer cur_ int mfluaPREmakeellipse(integer major_axis, integer minor_axis, integer theta , integer tx, integer ty,integer q) { lua_State *L = Luas[0]; - const char* file = "make_ellipse.lua"; + char* file = kpse_find_file("make_ellipse.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -1325,8 +1352,9 @@ int mfluaPREmakeellipse(integer major_axis, integer minor_axis, integer theta , int mfluaPOSTmakeellipse(integer major_axis, integer minor_axis, integer theta , integer tx, integer ty,integer q) { lua_State *L = Luas[0]; - const char* file = "make_ellipse.lua"; + char* file = kpse_find_file("make_ellipse.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -1370,8 +1398,9 @@ int mfluaPOSTmakeellipse(integer major_axis, integer minor_axis, integer theta , int mfluaprinttransitionlinefrom(integer x, integer y) { lua_State *L = Luas[0]; - const char* file = "fill_envelope.lua"; + char* file = kpse_find_file("fill_envelope.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ @@ -1403,8 +1432,9 @@ int mfluaprinttransitionlinefrom(integer x, integer y) int mfluaprinttransitionlineto(integer x, integer y) { lua_State *L = Luas[0]; - const char* file = "fill_envelope.lua"; + char* file = kpse_find_file("fill_envelope.lua", kpse_lua_format, 0); int res = luaL_loadfile(L, file); + if (file) free (file); if ( res==0 ){ res = lua_pcall(L, 0, 0, 0); if (res==0){ diff --git a/Build/source/texk/web2c/mfluadir/mfluatraptest b/Build/source/texk/web2c/mfluadir/mfluatraptest index 92866a869ad..29fa6f09e66 100755 --- a/Build/source/texk/web2c/mfluadir/mfluatraptest +++ b/Build/source/texk/web2c/mfluadir/mfluatraptest @@ -6,14 +6,14 @@ testdir=$abs_srcdir/triptrap ltestdir=$abs_srcdir/mfluadir/mfluatrap -TEXMFCNF=$ltestdir; export TEXMFCNF +TEXMFCNF=$ltestdir +LUAINPUTS=$ltestdir +export TEXMFCNF LUAINPUTS rm -rf mfluatrapdir mkdir mfluatrapdir cd mfluatrapdir -cp $ltestdir/*.lua . - echo ">>> Running TRAP test for MFLua." >&2 echo ">>> See $ltestdir/mfluatrap.diffs for example of acceptable diffs." >&2 diff --git a/Build/source/texk/web2c/mfluajitdir/ChangeLog b/Build/source/texk/web2c/mfluajitdir/ChangeLog index 5766f9c91dc..be63880f2eb 100644 --- a/Build/source/texk/web2c/mfluajitdir/ChangeLog +++ b/Build/source/texk/web2c/mfluajitdir/ChangeLog @@ -1,3 +1,7 @@ +2015-07-02 Peter Breitenlohner <peb@mppmu.mpg.de> + + * mfluajittraptest: Use ../mfluadir/mfluatrap/*.lua files. + 2015-06-22 Peter Breitenlohner <peb@mppmu.mpg.de> * am/mfluajit.am: Use $(tie_c) and $(tie_m). diff --git a/Build/source/texk/web2c/mfluajitdir/mfluajittraptest b/Build/source/texk/web2c/mfluajitdir/mfluajittraptest index 78437cd92a2..9d7008cea5f 100755 --- a/Build/source/texk/web2c/mfluajitdir/mfluajittraptest +++ b/Build/source/texk/web2c/mfluajitdir/mfluajittraptest @@ -7,14 +7,14 @@ testdir=$abs_srcdir/triptrap ltestdir=$abs_srcdir/mfluadir/mfluatrap jtestdir=$abs_srcdir/mfluajitdir/mfluajittrap -TEXMFCNF=$ltestdir; export TEXMFCNF +TEXMFCNF=$ltestdir +LUAINPUTS=$ltestdir +export TEXMFCNF LUAINPUTS rm -rf mfluajittrapdir mkdir mfluajittrapdir cd mfluajittrapdir -cp $ltestdir/*.lua . - echo ">>> Running TRAP test for MFLuaJIT." >&2 echo ">>> See $jtestdir/mfluajittrap.diffs for example of acceptable diffs." >&2 |