summaryrefslogtreecommitdiffhomepage
path: root/mixguile
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2001-08-21 00:30:40 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2001-08-21 00:30:40 +0000
commita254552d14cfe95b2ed2d861091879582de8ade6 (patch)
treea324c53d4bd6c792adf4dc0c5950b969d14e6878 /mixguile
parentf514dc310a1ef514de8f161b0c49756a8a302186 (diff)
downloadmdk-a254552d14cfe95b2ed2d861091879582de8ade6.tar.gz
mdk-a254552d14cfe95b2ed2d861091879582de8ade6.tar.bz2
initial guile support
Diffstat (limited to 'mixguile')
-rw-r--r--mixguile/Makefile.am24
-rw-r--r--mixguile/mixguile.c56
-rw-r--r--mixguile/mixguile.h49
-rw-r--r--mixguile/mixguile_cmd_dispatcher.c26
-rw-r--r--mixguile/mixguile_cmd_dispatcher.h47
5 files changed, 202 insertions, 0 deletions
diff --git a/mixguile/Makefile.am b/mixguile/Makefile.am
new file mode 100644
index 0000000..15d6308
--- /dev/null
+++ b/mixguile/Makefile.am
@@ -0,0 +1,24 @@
+## Process this file with automake to produce Makefile.in
+
+# Copyright (C) 2001 Free Software Foundation, Inc.
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+INCLUDES = -I$(includedir) -DG_LOG_DOMAIN=\"libmixguile\"
+
+noinst_LIBRARIES = libmixguile.a
+
+if MAKE_GUILE
+libmixguile_a_SOURCES = mixguile.h mixguile.c \
+ mixguile_cmd_dispatcher.h mixguile_cmd_dispatcher.c
+
+else
+libmixguile_a_SOURCES =
+
+endif
diff --git a/mixguile/mixguile.c b/mixguile/mixguile.c
new file mode 100644
index 0000000..478c3d8
--- /dev/null
+++ b/mixguile/mixguile.c
@@ -0,0 +1,56 @@
+/* -*-c-*- -------------- mixguile.c :
+ * Implementation of the functions declared in mixguile.h
+ * ------------------------------------------------------------------
+ * Last change: Time-stamp: "01/08/21 02:26:10 jao"
+ * ------------------------------------------------------------------
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#include "mixguile.h"
+
+static mixguile_cmd_dispatcher_t *dispatcher_;
+static main_func_t main_fun_;
+
+/* do local initialisation and enter the user provided main */
+static void
+real_main_ (int argc, char *argv[])
+{
+ dispatcher_ = mixguile_cmd_dispatcher_new ();
+ (*main_fun_)(argc, argv);
+}
+
+/*
+ initialise the guile command dispatcher and enter the provided
+ main function. the mixlib is also initialised.
+*/
+void
+mixguile_init (int argc, char *argv[], main_func_t main_fun)
+{
+ mix_init_lib ();
+ main_fun_ = main_fun;
+ gh_enter (argc, argv, real_main_);
+}
+
+/* access the mixguile comand dispatcher */
+mixguile_cmd_dispatcher_t *
+mixguile_get_cmd_dispatcher (void)
+{
+ return dispatcher_;
+}
+
diff --git a/mixguile/mixguile.h b/mixguile/mixguile.h
new file mode 100644
index 0000000..319eb36
--- /dev/null
+++ b/mixguile/mixguile.h
@@ -0,0 +1,49 @@
+/* -*-c-*- ---------------- mixguile.h :
+ * Interface to the mixguile interpreter.
+ * ------------------------------------------------------------------
+ * Last change: Time-stamp: <01/08/21 02:26:18 jao>
+ * ------------------------------------------------------------------
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#ifndef MIXGUILE_H
+#define MIXGUILE_H
+
+#include <mixlib/mix.h>
+#include <guile/gh.h>
+#include "mixguile_cmd_dispatcher.h"
+
+/* the main function type */
+typedef void (*main_func_t) (int argc, char *argv[]);
+
+/*
+ initialise the guile command dispatcher and enter the provided
+ main function. the mixlib is also initialised.
+*/
+extern void
+mixguile_init (int argc, char *argv[], main_func_t main_fun);
+
+/* access the mixguile comand dispatcher */
+extern mixguile_cmd_dispatcher_t *
+mixguile_get_cmd_dispatcher (void);
+
+
+
+#endif /* MIXGUILE_H */
+
diff --git a/mixguile/mixguile_cmd_dispatcher.c b/mixguile/mixguile_cmd_dispatcher.c
new file mode 100644
index 0000000..2d7161a
--- /dev/null
+++ b/mixguile/mixguile_cmd_dispatcher.c
@@ -0,0 +1,26 @@
+/* -*-c-*- -------------- mixguile_cmd_dispatcher.c :
+ * Implementation of the functions declared in mixguile_cmd_dispatcher.h
+ * ------------------------------------------------------------------
+ * Last change: Time-stamp: "01/08/21 02:27:50 jao"
+ * ------------------------------------------------------------------
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "mixguile.h"
+#include "mixguile_cmd_dispatcher.h"
+
diff --git a/mixguile/mixguile_cmd_dispatcher.h b/mixguile/mixguile_cmd_dispatcher.h
new file mode 100644
index 0000000..5be1d13
--- /dev/null
+++ b/mixguile/mixguile_cmd_dispatcher.h
@@ -0,0 +1,47 @@
+/* -*-c-*- ---------------- mixguile_cmd_dispatcher.h :
+ * Command dispatcher with guile support
+ * ------------------------------------------------------------------
+ * Last change: Time-stamp: <01/08/21 02:24:45 jao>
+ * ------------------------------------------------------------------
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#ifndef MIXGUILE_CMD_DISPATCHER_H
+#define MIXGUILE_CMD_DISPATCHER_H
+
+#include <mixlib/mix.h>
+#include <mixlib/mix_vm_command.h>
+
+/* the guile command dispatcher type */
+typedef struct mixguile_cmd_dispatcher_t mixguile_cmd_dispatcher_t;
+
+/* create/destroy cmd dispatcher */
+extern mixguile_cmd_dispatcher_t *
+mixguile_cmd_dispatcher_new (void);
+
+extern void
+mixguile_cmd_dispatcher_delete (mixguile_cmd_dispatcher_t *dis);
+
+/* get the underlying vm dispatcher */
+extern mix_vm_cmd_dispatcher_t *
+mixguile_cmd_dispatcher_get_vm_dispatcher (const mix_vm_cmd_dispatcher_t *disp);
+
+
+#endif /* MIXGUILE_CMD_DISPATCHER_H */
+