summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--configure.in46
-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
7 files changed, 242 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am
index a3ce744..f58da94 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,7 +11,7 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
EXTRA_DIST = ABOUT-NLS autogen.sh configure mdk.spec
-SUBDIRS = po intl doc lib mixlib mixutils mixgtk misc samples
+SUBDIRS = po intl doc lib mixlib mixguile mixutils mixgtk misc samples
docdir = $(top_builddir)/doc
diff --git a/configure.in b/configure.in
index 88c1312..b7deb10 100644
--- a/configure.in
+++ b/configure.in
@@ -10,7 +10,7 @@
AC_INIT(mixlib/mix.h)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(mdk,0.4.2)
+AM_INIT_AUTOMAKE(mdk,0.5)
AM_MAINTAINER_MODE
@@ -57,6 +57,33 @@ dnl of rl_completion_matches
AC_CHECK_FUNCS(rl_completion_matches,,)
fi
+dnl Check for guile
+AC_ARG_WITH(guile,
+[ --with-guile build MDK with Guile support],
+[case "${withval}" in
+ yes) wguile=true ;;
+ no) wguile=false ;;
+ *) AC_MSG_ERROR(bad value ${withval} for --with-guile) ;;
+esac], [wguile=true])
+
+if test x$wguile = xtrue; then
+ AC_MSG_CHECKING(for Guile)
+ guile-config link > /dev/null || {
+ AC_MSG_RESULT(no)
+ wguile=false
+ }
+fi
+
+if test x$wguile = xtrue; then
+ GUILE_CFLAGS="`guile-config compile`"
+ GUILE_LDFLAGS="`guile-config link`"
+ LIBS="$LIBS $GUILE_LDFLAGS"
+ CFLAGS="$CFLAGS $GUILE_CFLAGS"
+ AC_MSG_RESULT(yes)
+fi
+
+AM_CONDITIONAL(MAKE_GUILE, test x$wguile = xtrue)
+
dnl Check for glib
AM_PATH_GLIB(1.2.0,
[LIBS="$LIBS $GLIB_LIBS" CFLAGS="$CFLAGS $GLIB_CFLAGS"],
@@ -99,7 +126,8 @@ Makefile
doc/Makefile
doc/img/Makefile
mixlib/Makefile
-mixlib/testsuite/Makefile
+mixlib/testsuite/Makefile
+mixguile/Makefile
mixutils/Makefile
mixgtk/Makefile
lib/Makefile
@@ -110,16 +138,20 @@ po/Makefile.in
)
if test x$readl = xtrue; then
- addinfo=", with readline support"
+ rlinfo=", with readline support"
+fi
+
+if test x$wguile = xtrue; then
+ guileinfo=", with guile support"
fi
echo
echo "*** GNU MDK $VERSION has been successfully configured. ***"
echo
-echo "Type make to build the following utilities:"
-echo " - mixasm (MIX assembler${addinfo})"
-echo " - mixvm (MIX virtual machine)"
+echo "Type 'make' to build the following utilities:"
+echo " - mixasm (MIX assembler)"
+echo " - mixvm (MIX virtual machine${rlinfo}${guileinfo})"
if test x$gui = xtrue; then
-echo " - gmixvm (mixvm GTK+ GUI)"
+echo " - gmixvm (mixvm GTK+ GUI${guileinfo})"
fi
echo
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 */
+