standardize some names
This commit is contained in:
parent
fffcc8b9ab
commit
155f6a8027
|
@ -249,7 +249,7 @@ static int pmain (lua_State *L) {
|
||||||
if (s->status != 0) return 0;
|
if (s->status != 0) return 0;
|
||||||
|
|
||||||
/* call main() */
|
/* call main() */
|
||||||
assign_call_graph_depth_to_name(L, /*depth*/2, "main"); /* manually seed debug info */
|
save_call_graph_depth(L, /*depth*/2, "main"); /* manually seed debug info */
|
||||||
lua_getglobal(L, "main");
|
lua_getglobal(L, "main");
|
||||||
s->status = docall(L, 0, 1);
|
s->status = docall(L, 0, 1);
|
||||||
if (s->status != 0) return report_in_developer_mode(L, s->status);
|
if (s->status != 0) return report_in_developer_mode(L, s->status);
|
||||||
|
|
19
src/teliva.c
19
src/teliva.c
|
@ -276,7 +276,7 @@ void draw_highlighted_definition_name(const char* definition_name) {
|
||||||
addstr(" ");
|
addstr(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
void assign_call_graph_depth_to_name(lua_State* L, int depth, const char* name) {
|
void save_call_graph_depth(lua_State* L, int depth, const char* name) {
|
||||||
/* Maintain a global table mapping from function name to call-stack depth
|
/* Maintain a global table mapping from function name to call-stack depth
|
||||||
* at first call to it.
|
* at first call to it.
|
||||||
*
|
*
|
||||||
|
@ -298,7 +298,7 @@ void assign_call_graph_depth_to_name(lua_State* L, int depth, const char* name)
|
||||||
lua_pop(L, 1); // table
|
lua_pop(L, 1); // table
|
||||||
}
|
}
|
||||||
|
|
||||||
static void save_caller_as(lua_State* L, const char* name, const char* caller_name) {
|
static void save_caller(lua_State* L, const char* name, const char* caller_name) {
|
||||||
// push table of caller tables
|
// push table of caller tables
|
||||||
luaL_newmetatable(L, "__teliva_caller");
|
luaL_newmetatable(L, "__teliva_caller");
|
||||||
int ct = lua_gettop(L);
|
int ct = lua_gettop(L);
|
||||||
|
@ -323,16 +323,16 @@ void record_metadata_about_function_call (lua_State *L, CallInfo *ci) {
|
||||||
lua_Debug f;
|
lua_Debug f;
|
||||||
lua_getstack(L, 0, &f);
|
lua_getstack(L, 0, &f);
|
||||||
lua_getinfo(L, "n", &f);
|
lua_getinfo(L, "n", &f);
|
||||||
long int call_depth = ci - L->base_ci;
|
long int call_graph_depth = ci - L->base_ci;
|
||||||
/* note to self: the function pointer is at ci_func(ci) */
|
/* note to self: the function pointer is at ci_func(ci) */
|
||||||
if (f.name) {
|
if (f.name) {
|
||||||
assign_call_graph_depth_to_name(L, call_depth, f.name);
|
save_call_graph_depth(L, call_graph_depth, f.name);
|
||||||
if (call_depth <= 1) return;
|
if (call_graph_depth <= 1) return;
|
||||||
lua_Debug caller_f;
|
lua_Debug caller_f;
|
||||||
lua_getstack(L, 1, &caller_f);
|
lua_getstack(L, 1, &caller_f);
|
||||||
lua_getinfo(L, "n", &caller_f);
|
lua_getinfo(L, "n", &caller_f);
|
||||||
if (caller_f.name)
|
if (caller_f.name)
|
||||||
save_caller_as(L, f.name, caller_f.name);
|
save_caller(L, f.name, caller_f.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1243,7 +1243,7 @@ static int run_tests(lua_State* L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_call_graph(lua_State* L) {
|
static void clear_call_graph_depth(lua_State* L) {
|
||||||
int oldtop = lua_gettop(L);
|
int oldtop = lua_gettop(L);
|
||||||
luaL_newmetatable(L, "__teliva_call_graph_depth");
|
luaL_newmetatable(L, "__teliva_call_graph_depth");
|
||||||
int cgt = lua_gettop(L);
|
int cgt = lua_gettop(L);
|
||||||
|
@ -1764,10 +1764,11 @@ int load_image(lua_State* L, char** argv, int n) {
|
||||||
//? exit(1);
|
//? exit(1);
|
||||||
status = load_definitions(L);
|
status = load_definitions(L);
|
||||||
if (status != 0) return 0;
|
if (status != 0) return 0;
|
||||||
|
/* run tests */
|
||||||
status = run_tests(L);
|
status = run_tests(L);
|
||||||
if (status != 0) return report_in_developer_mode(L, status);
|
if (status != 0) return report_in_developer_mode(L, status);
|
||||||
/* clear callgraph stats from running tests */
|
/* clear stats from running tests */
|
||||||
clear_call_graph(L);
|
clear_call_graph_depth(L);
|
||||||
clear_caller(L);
|
clear_caller(L);
|
||||||
/* initialize permissions */
|
/* initialize permissions */
|
||||||
load_permissions_from_user_configuration(L);
|
load_permissions_from_user_configuration(L);
|
||||||
|
|
|
@ -164,7 +164,7 @@ extern void save_to_current_definition_and_editor_buffer(lua_State* L, const cha
|
||||||
extern void save_editor_state(int rowoff, int coloff, int cy, int cx);
|
extern void save_editor_state(int rowoff, int coloff, int cy, int cx);
|
||||||
int editor_view_in_progress(lua_State* L);
|
int editor_view_in_progress(lua_State* L);
|
||||||
|
|
||||||
extern void assign_call_graph_depth_to_name(lua_State* L, int depth, const char* name);
|
extern void save_call_graph_depth(lua_State* L, int depth, const char* name);
|
||||||
extern void draw_callers_of_current_definition(lua_State* L);
|
extern void draw_callers_of_current_definition(lua_State* L);
|
||||||
|
|
||||||
extern void append_to_audit_log(lua_State* L, const char* buffer);
|
extern void append_to_audit_log(lua_State* L, const char* buffer);
|
||||||
|
|
Loading…
Reference in New Issue