X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fgacela.c;h=6891d4b9f1180e661f256703cd07fde8b68c1c18;hb=e82142f2231e5aacf47e3f0cf5e82679d4291af2;hp=a75fe73ef14ef7bf3a2f9f19cc7035666215f5c9;hpb=b5c968767be22ea1aeff7806c191a223c204184b;p=gacela.git diff --git a/src/gacela.c b/src/gacela.c index a75fe73..6891d4b 100644 --- a/src/gacela.c +++ b/src/gacela.c @@ -177,7 +177,7 @@ gacela_client (SCM rec_channel, SCM send_channel) } static void* -init_gacela (void *data, int argc, char **argv) +init_scheme (void *data, int argc, char **argv) { // Guile configuration scm_c_eval_string ("(set-repl-prompt! \"gacela> \")"); @@ -205,11 +205,11 @@ load_scheme_files (char *path) } void -start_single () +init_gacela (char *path) { - char *argv = "guile"; - - scm_shell (1, &argv); + scm_with_guile (&init_scheme, NULL); + load_scheme_files (path); + scm_c_eval_string ("(init-video-mode)"); } void @@ -245,7 +245,7 @@ int main (int argc, char *argv[]) { char *arg; - int mode = 0; // shell: 1, server: 2, client: 3 + int mode = 0; // dev: 1, server: 2, client: 3 char *host; int port = 0; int i; @@ -254,7 +254,7 @@ main (int argc, char *argv[]) // Checking arguments for (i = 1; i < argc; i++) { - if (strcmp (argv[i], "--shell-mode") == 0) + if (strcmp (argv[i], "--dev") == 0) mode = 1; else if (strncmp (argv[i], "--server", 8) == 0) { mode = 2; @@ -279,18 +279,6 @@ main (int argc, char *argv[]) scm_init_guile (); if (mode == 1) { - scm_with_guile (&init_gacela, NULL); - load_scheme_files (dirname (argv[0])); - start_single (); - } - else if (mode == 2 && port != 0) { - scm_with_guile (&init_gacela, NULL); - load_scheme_files (dirname (argv[0])); - start_server (port); - } - else if (mode == 3 && port != 0) - start_remote_client (host, port); - else { fd1 = scm_pipe (); fd2 = scm_pipe (); pid = fork (); @@ -298,8 +286,7 @@ main (int argc, char *argv[]) if (pid == 0) { scm_close (SCM_CAR (fd1)); scm_close (SCM_CDR (fd2)); - scm_with_guile (&init_gacela, NULL); - load_scheme_files (dirname (argv[0])); + init_gacela (dirname (argv[0])); start_local_server (scm_cons (SCM_CAR (fd2), SCM_CDR (fd1))); } else { @@ -309,4 +296,15 @@ main (int argc, char *argv[]) kill (pid, SIGKILL); } } + else if (mode == 2 && port != 0) { + init_gacela (dirname (argv[0])); + start_server (port); + } + else if (mode == 3 && port != 0) + start_remote_client (host, port); + else { + init_gacela (dirname (argv[0])); + scm_shell (argc, argv); + SDL_Quit (); + } }