]> git.jsancho.org Git - gacela.git/commitdiff
(no commit message)
authorjsancho <devnull@localhost>
Sat, 30 Apr 2011 07:42:46 +0000 (07:42 +0000)
committerjsancho <devnull@localhost>
Sat, 30 Apr 2011 07:42:46 +0000 (07:42 +0000)
gacela.c
gacela_SDL.c [new file with mode: 0644]
gacela_SDL.h [new file with mode: 0644]

index 90ba5c8813d5129f7d7f80e304be1a521d9a23d2..45c83a114e0770c02a82e4d998d76b199dfe65e2 100644 (file)
--- a/gacela.c
+++ b/gacela.c
@@ -1,67 +1,21 @@
-#include <stdio.h>
-#include <readline/readline.h>
-#include <sys/types.h>
-#include <unistd.h>
+#include <GL/gl.h>
 #include <libguile.h>
+#include "gacela_SDL.h"
 
-/* Read-Send-Print-Loop */
-void rspl(int pin, int pout)
+static void*
+register_functions (void* data)
 {
-  static char *line = (char *)NULL;
-  int exit = 0;
-
-  while (!exit) {
-    if (line) {
-      free(line);
-      line = (char *)NULL;
-    }
-    
-    line = readline("gacela>");
-    
-    if (line && *line) {
-      add_history(line);
-      if (strcmp(line, "(quit)") == 0)
-       exit = 1;
-      else {
-       write(pout, line, strlen(line));
-       write(pout, "\n", 1);
-      }
-    }
-  }
+  SDL_register_functions (NULL);
+  return NULL;
 }
 
-int main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
 {
-  pid_t cpid;
-  int pfd[2];
-
-  pipe(pfd);
-  cpid = fork();
-  if (cpid != 0) {
-    rspl(pfd[0], pfd[1]);
-    return 0;
-  }
-  else {
-    char buf;
-    static char *line = (char *)NULL;
-
-    dup2(pfd[0], 0);
-    close(pfd[0]);
-
-    while (1) {
-      scm_init_guile();
-      scm_c_eval_string("(if (char-ready? (current-input-port)) (format #t \"~a guile~%\" (read)))");
-      /*
-      if (line) {
-       free(line);
-       line = (char *)NULL;
-      }
-
-      line = readline("");
-      if (line && *line) {
-       printf("%s-\n", line);
-      }
-      */
-    }
-  }
+  scm_with_guile (&register_functions, NULL);
+  scm_init_guile ();
+  scm_c_eval_string ("(set-repl-prompt! \"gacela>\")");
+  scm_c_eval_string ("(use-modules (ice-9 readline))");
+  scm_c_eval_string ("(activate-readline)");
+  scm_shell (argc, argv);
 }
diff --git a/gacela_SDL.c b/gacela_SDL.c
new file mode 100644 (file)
index 0000000..964c0ed
--- /dev/null
@@ -0,0 +1,9 @@
+#include <libguile.h>
+#include <SDL/SDL.h>
+#include "gacela_SDL.h"
+
+static void*
+SDL_register_functions (void* data)
+{
+  return NULL;
+}
diff --git a/gacela_SDL.h b/gacela_SDL.h
new file mode 100644 (file)
index 0000000..8b5e033
--- /dev/null
@@ -0,0 +1 @@
+static void* SDL_register_functions (void* data);