Lines 210-216
static int tuplua_function_definerule(lua_State *ls)
Link Here
|
210 |
if(parse_dependent_tupfiles(&input_path_list, tf) < 0) |
210 |
if(parse_dependent_tupfiles(&input_path_list, tf) < 0) |
211 |
return luaL_error(ls, "Error while parsing dependent Tupfiles"); |
211 |
return luaL_error(ls, "Error while parsing dependent Tupfiles"); |
212 |
if(get_name_list(tf, &input_path_list, &nl, 1) < 0) |
212 |
if(get_name_list(tf, &input_path_list, &nl, 1) < 0) |
213 |
return -1; |
213 |
return luaL_error(ls, "Error while scanning 'inputs'."); |
214 |
|
214 |
|
215 |
init_name_list(&r.inputs); |
215 |
init_name_list(&r.inputs); |
216 |
init_name_list(&r.order_only_inputs); |
216 |
init_name_list(&r.order_only_inputs); |
Lines 329-335
static int tuplua_function_getrelativedir(lua_State *ls)
Link Here
|
329 |
struct estring e; |
329 |
struct estring e; |
330 |
|
330 |
|
331 |
if(estring_init(&e) < 0) |
331 |
if(estring_init(&e) < 0) |
332 |
return -1; |
332 |
return luaL_error(ls, "No memory"); |
333 |
|
333 |
|
334 |
dirname = tuplua_tostring(ls, -1); |
334 |
dirname = tuplua_tostring(ls, -1); |
335 |
if(!dirname) |
335 |
if(!dirname) |
Lines 338-344
static int tuplua_function_getrelativedir(lua_State *ls)
Link Here
|
338 |
if(dest < 0) |
338 |
if(dest < 0) |
339 |
return luaL_error(ls, "Failed to find tup entry for '%s' relative to the current Tupfile", dirname); |
339 |
return luaL_error(ls, "Failed to find tup entry for '%s' relative to the current Tupfile", dirname); |
340 |
if(get_relative_dir(NULL, &e, NULL, dest, tf->tupid, NULL) < 0) |
340 |
if(get_relative_dir(NULL, &e, NULL, dest, tf->tupid, NULL) < 0) |
341 |
return -1; |
341 |
return luaL_error(ls, "get_relative_dir() failed"); |
342 |
lua_pushlstring(ls, e.s, e.len); |
342 |
lua_pushlstring(ls, e.s, e.len); |
343 |
free(e.s); |
343 |
free(e.s); |
344 |
return 1; |
344 |
return 1; |
Lines 359-365
static int tuplua_function_getconfig(lua_State *ls)
Link Here
|
359 |
return luaL_error(ls, "Must be passed an config variable name as an argument."); |
359 |
return luaL_error(ls, "Must be passed an config variable name as an argument."); |
360 |
value_size = tup_db_get_varlen(tf->variant, name, name_size) + 1; |
360 |
value_size = tup_db_get_varlen(tf->variant, name, name_size) + 1; |
361 |
if(value_size < 0) |
361 |
if(value_size < 0) |
362 |
luaL_error(ls, "Failed to get config variable length."); |
362 |
return luaL_error(ls, "Failed to get config variable length."); |
363 |
value = malloc(value_size); |
363 |
value = malloc(value_size); |
364 |
value_as_argument = value; |
364 |
value_as_argument = value; |
365 |
|
365 |
|