gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/gsl-shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'gsl-shell.c')
-rw-r--r--gsl-shell.c 86
1 files changed, 11 insertions, 75 deletions
diff --git a/gsl-shell.c b/gsl-shell.c
index 84fb16d8..928c8020 100644
--- a/gsl-shell.c
+++ b/gsl-shell.c
@@ -64,23 +64,8 @@
#include "lua-gsl.h"
#include "lua-utils.h"
-#ifdef AGG_PLOT_ENABLED
-#include "object-index.h"
-#include "window.h"
-#endif
-
#define report error_report
-struct window_unref_cell {
- int id;
- struct window_unref_cell *next;
-};
-
-#define UNREF_FIXED_SIZE 8
-static int unref_fixed_list[UNREF_FIXED_SIZE];
-static size_t unref_fixed_count = 0;
-
-static struct window_unref_cell *window_unref_list = NULL;
static lua_State *globalL = NULL;
static const char *progname = LUA_PROGNAME;
@@ -285,8 +270,13 @@ static int pushline (lua_State *L, int firstline) {
char *b = buffer;
size_t l;
const char *prmt = get_prompt(L, firstline);
+ int ok;
- if (lua_readline(L, b, prmt) == 0)
+ GSL_SHELL_UNLOCK();
+ ok = lua_readline(L, b, prmt);
+ GSL_SHELL_LOCK();
+
+ if (ok == 0)
{
return 0; /* no input */
}
@@ -335,35 +325,12 @@ static int loadline (lua_State *L) {
return status;
}
-static void do_windows_unref (lua_State *L)
-{
- struct window_unref_cell *wu;
- size_t j;
-
- GSL_SHELL_LOCK();
-
- for (j = 0; j < unref_fixed_count; j++)
- {
- object_index_remove (L, OBJECT_WINDOW, unref_fixed_list[j]);
- }
-
- unref_fixed_count = 0;
-
- for (wu = window_unref_list; wu != NULL; /* */)
- {
- struct window_unref_cell *nxt = wu->next;
- object_index_remove (L, OBJECT_WINDOW, wu->id);
- free (wu);
- wu = nxt;
- }
- window_unref_list = NULL;
-
- GSL_SHELL_UNLOCK();
-}
-
static void dotty (lua_State *L) {
const char *oldprogname = progname;
progname = NULL;
+
+ GSL_SHELL_LOCK();
+
for (;;)
{
int status = loadline(L);
@@ -384,24 +351,12 @@ static void dotty (lua_State *L) {
l_message(progname, emsg);
}
}
-
-#ifdef AGG_PLOT_ENABLED
- do_windows_unref (L);
-#endif
}
-#ifdef AGG_PLOT_ENABLED
- object_index_apply_all (L, OBJECT_WINDOW, window_close);
-
- do
- {
- do_windows_unref (L);
- }
- while (object_index_count (L, OBJECT_WINDOW) > 0);
-#endif
-
lua_settop(L, 0); /* clear stack */
+ GSL_SHELL_UNLOCK();
+
fputs("\n", stdout);
fflush(stdout);
progname = oldprogname;
@@ -589,22 +544,3 @@ int main (int argc, char **argv) {
return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS;
}
-
-void
-gsl_shell_unref_plot (int id)
-{
- if (unref_fixed_count < UNREF_FIXED_SIZE)
- {
- unref_fixed_list[unref_fixed_count] = id;
- unref_fixed_count ++;
- }
- else
- {
- struct window_unref_cell *cell = malloc(sizeof(struct window_unref_cell));
-
- cell->id = id;
- cell->next = window_unref_list;
-
- window_unref_list = cell;
- }
-}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月29日 00:35:18 +0000

AltStyle によって変換されたページ (->オリジナル) /