Add kpse_absolute_p wrapper
This commit is contained in:
parent
5b0ecc6946
commit
a2780d7ccb
21
lkpselib.c
21
lkpselib.c
@ -21,6 +21,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <kpathsea/absolute.h>
|
||||||
#include <kpathsea/c-pathch.h>
|
#include <kpathsea/c-pathch.h>
|
||||||
#include <kpathsea/lib.h>
|
#include <kpathsea/lib.h>
|
||||||
#include <kpathsea/proginit.h>
|
#include <kpathsea/proginit.h>
|
||||||
@ -299,6 +300,24 @@ static int lua_kpathsea_var_value(lua_State * L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int is_absolute(lua_State * L)
|
||||||
|
{
|
||||||
|
const char *path = luaL_checkstring(L, 1);
|
||||||
|
boolean accept_relative = lua_toboolean(L, 2);
|
||||||
|
TEST_PROGRAM_NAME_SET;
|
||||||
|
lua_pushboolean(L, kpse_absolute_p(path, accept_relative));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lua_kpathsea_is_absolute(lua_State * L)
|
||||||
|
{
|
||||||
|
kpathsea *kp = (kpathsea *) luaL_checkudata(L, 1, KPATHSEA_METATABLE);
|
||||||
|
const char *path = luaL_checkstring(L, 2);
|
||||||
|
boolean accept_relative = lua_toboolean(L, 3);
|
||||||
|
lua_pushboolean(L, kpathsea_absolute_p(*kp, path, accept_relative));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned find_dpi(const_string s)
|
static unsigned find_dpi(const_string s)
|
||||||
{
|
{
|
||||||
unsigned dpi_number = 0;
|
unsigned dpi_number = 0;
|
||||||
@ -821,6 +840,7 @@ static const struct luaL_Reg kpselib_m[] = {
|
|||||||
{"default_texmfcnf", show_texmfcnf},
|
{"default_texmfcnf", show_texmfcnf},
|
||||||
{"record_input_file", lua_record_input_file},
|
{"record_input_file", lua_record_input_file},
|
||||||
{"record_output_file", lua_record_output_file},
|
{"record_output_file", lua_record_output_file},
|
||||||
|
{"is_absolute", lua_kpathsea_is_absolute},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -839,6 +859,7 @@ static const struct luaL_Reg kpselib_l[] = {
|
|||||||
{"set_maketex", lua_set_maketex},
|
{"set_maketex", lua_set_maketex},
|
||||||
{"version", lua_kpse_version},
|
{"version", lua_kpse_version},
|
||||||
{"default_texmfcnf", show_texmfcnf},
|
{"default_texmfcnf", show_texmfcnf},
|
||||||
|
{"is_absolute", is_absolute},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user