diff options
-rw-r--r-- | AUTHORS | 4 | ||||
-rw-r--r-- | INSTALL | 130 | ||||
-rw-r--r-- | configure.in | 31 | ||||
-rw-r--r-- | doc/mdk.texi | 50 | ||||
-rw-r--r-- | doc/mdk_bugs.texi | 10 | ||||
-rw-r--r-- | doc/mdk_emixvm.texi | 24 | ||||
-rw-r--r-- | doc/mdk_gstart.texi | 2 | ||||
-rw-r--r-- | doc/mdk_install.texi | 58 | ||||
-rw-r--r-- | doc/mdk_intro.texi | 2 | ||||
-rw-r--r-- | doc/mdk_mixasm.texi | 2 | ||||
-rw-r--r-- | doc/mdk_mixvm.texi | 4 | ||||
-rw-r--r-- | doc/mdk_tut.texi | 2 | ||||
-rw-r--r-- | mixutils/mixvm_command.c | 17 | ||||
-rw-r--r-- | mixutils/mixvm_loop.c | 26 |
14 files changed, 321 insertions, 41 deletions
@@ -1,4 +1,6 @@ Authors of GNU MDK. See also the files THANKS and ChangeLog. -jose antonio ortega ruiz designed and implemented mdk. +Jose A. Ortega Ruiz designed and implemented mdk. + +Philip E. King designed and implemented mixvm.el.
\ No newline at end of file @@ -1,3 +1,133 @@ +1. Installing MDK + + 1.1 Download the source tarball + 1.2 Requirements + 1.3 Basic installation + 1.4 Emacs support + 1.5 Special configure flags + 1.6 Generic configure help + +1.1 Download the source tarball +------------------------------- + +GNU MDK is distributed as a source tarball available for download in the +following URLs: + + * ftp://ftp.gnu.org/pub/gnu/mdk (or one of its mirrors) + * http://sourceforge.net/project/showfiles.php?group_id=13897 + +The above sites contain the latest stable releases of MDK. The development +branch is available at: + + * http://sourceforge.net/cvs/?group_id=13897 + +After you have downloaded the source tarball, unpack it in a directory of +your choice using the command: + + tar xfvz mdk-X.Y.tar.gz + +where X.Y stands for the downloaded version (the current stable release +being version ). + + +1.2 Requirements +---------------- + +In order to build and install MDK, you will need the following libraries +installed in your system: + + * GLIB 1.2.0 (required) + * GNU Flex 2.3 (required) + * GTK+ 1.2.0 (optional) + * libglade (optional) + * GNU readline and history libraries (optional) + +If present, readline and history are used to provide command completion and +history management to the command line MIX virtual machine, mixvm GTK+ and +libglade are needed if you want to build the graphical interface to the MIX +virtual machine, gmixvm. + +Please note: you need both the libraries and the headers; this means both +the library package and the `-dev' package if you do not compile your +libraries yourself (ex: installing `libgtk1.2' and `libgtk1.2-dev' on +Debian). + + +1.3 Basic installation +---------------------- + +MDK uses GNU Autoconf and Automake tools, and, therefore, should be built +and installed without hassle using the following commands inside the source +directory: + + ./configure + make + make install + +where the last one must be run as root. + +The first command, configure, will setup the makefiles for your system. In +particular, configure will look for GTK+ and libglade, and, if they are +present, will generate the appropiate makefiles for building the gmixvm +graphical user interface. Upon completion, you should see a message with the +configuration results like the following: + + *** GNU MDK 0.3 has been successfully configured. *** + + Type make to build the following utilities: + - mixasm (MIX assembler) + - mixvm (MIX virtual machine, with readline support) + - gmixvm (mixvm GTK+ GUI) + +where the last line may be missing if you lack the above mentioned +libraries. + +The next command, make, will actually build the MDK programs in the +following locations: + + * `mixutils/mixasm' + * `mixutils/mixvm' + * `mixgtk/gmixvm' + +You can run these programs from within their directories, but I recommend +you to install them in proper locations using make install from a root +shell. + +1.4 Emacs support +----------------- + +mixvm can be run within an Emacs GUD buffer using the elisp +program misc/mixvm.el, kindly contributed by Philip King. + +mixvm.el provides an interface between mdk's mixvm +and Emacs, via GUD. Place this file in your load-path, +optionally adding the following line to your .emacs file: + +(autoload 'mixvm "mixvm" "mixvm/gud interaction" t) + + +1.5 Special configure flags +--------------------------- + +You can fine tunning the configuration process using the following switches +with configure: + +User Option: --enable-gui[=yes|no] +User Option: --disable-gui + Enables/disables the built of the MIX virtual machine GUI (gmixvm). If + the required libraries are missing (see section 1.2 Requirements) the + configure script with automatically disable this feature. + +User Option: --with-readline[=yes|no] +User Option: --without-readline + Enables/disables the GNU Readline support for mixvm. If the required + libraries are missing (see section 1.2 Requirements) the configure + script with automatically disable this feature. + + +1.6 Generic configure help +-------------------------- + Basic Installation ================== diff --git a/configure.in b/configure.in index a8c1c47..c27cde4 100644 --- a/configure.in +++ b/configure.in @@ -31,9 +31,28 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix AC_DEFINE_UNQUOTED(LOCALEDIR, "${prefix}/share/locale") dnl Check for readline and history -AC_CHECK_LIB(ncurses, initscr, , AC_MSG_ERROR(Cannot find ncurses lib)) -AC_CHECK_LIB(readline, readline, , AC_MSG_ERROR(Cannot find GNU readline lib)) -AC_CHECK_LIB(history, add_history, , AC_MSG_ERROR(Cannot find GNU history lib)) +AC_ARG_WITH(readline, +[ --with-readline build mixvm with readline support], +[case "${withval}" in + yes) readl=true ;; + no) readl=false ;; + *) AC_MSG_ERROR(bad value ${withval} for --with-readline) ;; +esac], [readl=true]) + +if test x$readl = xtrue; then + AC_CHECK_LIB(ncurses, initscr, , + [AC_MSG_WARN(Cannot find ncurses lib) readl=false]) +fi + +if test x$readl = xtrue; then + AC_CHECK_LIB(readline, readline, , + [AC_MSG_WARN(Cannot find GNU readline lib) readl=false]) +fi + +if test x$readl = xtrue; then +AC_CHECK_LIB(history, add_history, , + [AC_MSG_WARN(Cannot find GNU history lib) readl=false]) +fi dnl Check for glib AM_PATH_GLIB(1.2.0, @@ -83,11 +102,15 @@ samples/Makefile po/Makefile.in ) +if test x$readl = xtrue; then + addinfo=", with readline support" +fi + echo echo "*** GNU MDK $VERSION has been successfully configured. ***" echo echo "Type make to build the following utilities:" -echo " - mixasm (MIX assembler)" +echo " - mixasm (MIX assembler${addinfo})" echo " - mixvm (MIX virtual machine)" if test x$gui = xtrue; then echo " - gmixvm (mixvm GTK+ GUI)" diff --git a/doc/mdk.texi b/doc/mdk.texi index 1a985c5..ba5b94f 100644 --- a/doc/mdk.texi +++ b/doc/mdk.texi @@ -10,6 +10,7 @@ @set EDITION 0.3 @set VERSION 0.3 @set JAO Jos@'e Antonio Ortega Ruiz +@set PHILIP Philip E. King @footnotestyle separate @ifinfo @@ -79,29 +80,48 @@ assembler-like language for programming a virtual computer called MIX. They were created by Donald Knuth in the first volume of @cite{The Art of Computer Programming} (Addison Wesley, 1997). +GNU @sc{mdk} is an official GNU package. + GNU @sc{mdk} was written by @value{JAO} and is released under the GNU General Public license (@pxref{Copying}), so that users are free to share and improve it. -GNU @sc{mdk} is an official GNU package. +@value{PHILIP} has contributed to this package development with many +helpful discussions, as well as actual code (@pxref{mixvm.el}). @end ifinfo @menu -* Introduction:: -* MIX and MIXAL tutorial:: Learn the innards of MIX and MIXAL. -* Getting started:: Basic usage of the @sc{mdk} tools. -* mixvm:: Invoking the MIX virtual machine. -* mixvm.el:: Using @code{mixvm} within Emacs. -* mixasm:: Invoking the MIXAL assembler. -* Copying:: @sc{mdk} licensing terms. -* Problems:: Reporting bugs. -* Concept Index:: Index of concepts. +* Introduction:: +* Installing MDK:: +* MIX and MIXAL tutorial:: Learn the innards of MIX and MIXAL. +* Getting started:: Basic usage of the @sc{mdk} tools. +* mixvm.el:: Using @code{mixvm} within Emacs. +* mixvm:: Invoking and using the MIX virtual machine. +* gmixvm:: +* mixasm:: Invoking the MIXAL assembler. +* Copying:: @sc{mdk} licensing terms. +* Problems:: Reporting bugs. +* Concept Index:: Index of concepts. + + + + + + @detailmenu --- The Detailed Node Listing --- +Installing @sc{mdk} + +* Download:: +* Requirements:: +* Basic installation:: +* Emacs support:: +* Special configure flags:: + MIX and MIXAL tutorial * The MIX computer:: Architecture and instruction set @@ -162,6 +182,12 @@ Interactive commands * Debug commands:: Debugging programs. * State commands:: Inspecting the virtual machine state. +gmixvm + +* Invoking @code{gmixvm}:: +* MIX virtual machine:: +* Menu and status bars:: + @code{mixasm}, the MIXAL assembler * Invoking @code{mixasm}:: @code{mixasm} options @@ -170,10 +196,12 @@ Interactive commands @end menu @include mdk_intro.texi +@include mdk_install.texi @include mdk_tut.texi @include mdk_gstart.texi -@include mdk_mixvm.texi @include mdk_emixvm.texi +@include mdk_mixvm.texi +@include mdk_gmixvm.texi @include mdk_mixasm.texi @include gpl.texi @include mdk_bugs.texi diff --git a/doc/mdk_bugs.texi b/doc/mdk_bugs.texi index 938c984..7531daa 100644 --- a/doc/mdk_bugs.texi +++ b/doc/mdk_bugs.texi @@ -2,10 +2,14 @@ @chapter Reporting Bugs @cindex bugs @cindex problems +@cindex questions +@cindex suggestions -If you find a bug in @sc{mdk} (or have questions, comments or suggestions -about it), please send electronic mail to @email{jaortega@@acm.org, -the author}. +If you have any questions, comments or suggestions, please send +electronic mail to @email{jao@@gnu.org, the author}. + +If you find a bug in @sc{mdk}, please send electronic mail to +@email{bug-mdk@@gnu.org, the @sc{mdk} bug list}. In your report, please include the version number, which you can find by running @w{@samp{mixasm --version}}. Also include in your message the diff --git a/doc/mdk_emixvm.texi b/doc/mdk_emixvm.texi index d99fd68..8fcbf55 100644 --- a/doc/mdk_emixvm.texi +++ b/doc/mdk_emixvm.texi @@ -1,9 +1,25 @@ -@node mixvm.el, mixasm, mixvm, Top +@node mixvm.el, mixvm, Getting started, Top @comment node-name, next, previous, up @chapter mixvm.el If you are an Emacs user and write your MIXAL programs using this editor, you will find the elisp program @file{mixvm.el} quite -useful. @file{mixvm.el} allows running the MIX virtual machine -@code{mixvm} (@pxref{mixvm}) inside an Emacs @acronym{GUD} buffer, while -visiting the MIXAL source file in another buffer. +useful@footnote{@file{mixvm.el} has been kindly contributed by +@value{PHILIP}. @file{mixvm.el} is based on a study of gdb, perldb, and +pdb as found in @file{gud.el}, and @file{rubydb3x.el} distributed with +the source code to the Ruby language.}. @file{mixvm.el} allows running +the MIX virtual machine @code{mixvm} (@pxref{mixvm}) inside an Emacs +@acronym{GUD} buffer, while visiting the MIXAL source file in another +buffer. + +After installing @file{mixvm.el} (@pxref{Emacs support}), you can +initiate an @sc{mdk}/@acronym{GUD} session inside Emacs with the command + +@example +M-x mixvm +@end example + +@noindent +and you will have a @code{mixvm} prompt inside a newly created +@acronym{GUD} buffer. @acronym{GUD} will reflect the current line in the +corresponding source file buffer. diff --git a/doc/mdk_gstart.texi b/doc/mdk_gstart.texi index cfa44ea..bde4160 100644 --- a/doc/mdk_gstart.texi +++ b/doc/mdk_gstart.texi @@ -1,4 +1,4 @@ -@node Getting started, mixvm, MIX and MIXAL tutorial, Top +@node Getting started, mixvm.el, MIX and MIXAL tutorial, Top @comment node-name, next, previous, up @chapter Getting started diff --git a/doc/mdk_install.texi b/doc/mdk_install.texi index c9ea868..78690ba 100644 --- a/doc/mdk_install.texi +++ b/doc/mdk_install.texi @@ -1,8 +1,16 @@ -@node Installing @sc{mdk} +@node Installing MDK, MIX and MIXAL tutorial, Introduction, Top @comment node-name, next, previous, up @chapter Installing @sc{mdk} -@node Download +@menu +* Download:: +* Requirements:: +* Basic installation:: +* Emacs support:: +* Special configure flags:: +@end menu + +@node Download, Requirements, Installing MDK, Installing MDK @comment node-name, next, previous, up @section Download the source tarball @@ -36,7 +44,7 @@ tar xfvz mdk-X.Y.tar.gz where @var{X.Y} stands for the downloaded version (the current stable release being version @value{VERSION}). -@node Requirements +@node Requirements, Basic installation, Download, Installing MDK @comment node-name, next, previous, up @section Requirements @@ -67,7 +75,7 @@ headers; this means both the library package and the @file{-dev} package if you do not compile your libraries yourself (ex: installing @file{libgtk1.2} and @file{libgtk1.2-dev} on Debian). -@node Basic installation +@node Basic installation, Emacs support, Requirements, Installing MDK @comment node-name, next, previous, up @section Basic installation @@ -96,7 +104,7 @@ following: Type make to build the following utilities: - mixasm (MIX assembler) - - mixvm (MIX virtual machine) + - mixvm (MIX virtual machine, with readline support) - gmixvm (mixvm GTK+ GUI) @end example @@ -120,16 +128,52 @@ You can run these programs from within their directories, but I recommend you to install them in proper locations using @code{make install} from a root shell. -@node Special configure flags +@node Emacs support, Special configure flags, Basic installation, Installing MDK +@comment node-name, next, previous, up +@section Emacs support + +@code{mixvm} can be run within an Emacs GUD buffer using the elisp +program @file{misc/mixvm.el}, kindly contributed by @value{PHILIP}. + +@file{mixvm.el} provides an interface between @sc{mdk}'s @code{mixvm} +and Emacs, via @acronym{GUD}. Place this file in your load-path, +optionally adding the following line to your @file{.emacs} file: + +@lisp +(autoload 'mixvm "mixvm" "mixvm/gud interaction" t) +@end lisp + + + +@node Special configure flags, , Emacs support, Installing MDK @comment node-name, next, previous, up @section Special configure flags You can fine tunning the configuration process using the following switches with configure: +@defopt --enable-gui[=yes|no] +@defoptx --disable-gui +Enables/disables the built of the MIX virtual machine GUI +(@code{gmixvm}). If the required libraries are missing +(@pxref{Requirements}) the configure script with automatically disable +this feature. +@end defopt + +@defopt --with-readline[=yes|no] +@defoptx --without-readline +Enables/disables the GNU Readline support for @code{mixvm}. If the +required libraries are missing (@pxref{Requirements}) the configure +script with automatically disable this feature. +@end defopt +For additional, boilerplate configure options, see the @file{INSTALL} +file, or run + +@example +configure --help +@end example -Platforms diff --git a/doc/mdk_intro.texi b/doc/mdk_intro.texi index 8d1cfba..2a3f95d 100644 --- a/doc/mdk_intro.texi +++ b/doc/mdk_intro.texi @@ -1,4 +1,4 @@ -@node Introduction, MIX and MIXAL tutorial, Top, Top +@node Introduction, Installing MDK, Top, Top @comment node-name, next, previous, up @unnumbered Introduction @cindex Introduction diff --git a/doc/mdk_mixasm.texi b/doc/mdk_mixasm.texi index d48852a..753aa33 100644 --- a/doc/mdk_mixasm.texi +++ b/doc/mdk_mixasm.texi @@ -1,4 +1,4 @@ -@node mixasm, Copying, mixvm.el, Top +@node mixasm, Copying, gmixvm, Top @comment node-name, next, previous, up @chapter @code{mixasm}, the MIXAL assembler @cindex @code{mixasm} diff --git a/doc/mdk_mixvm.texi b/doc/mdk_mixvm.texi index 56a14fa..8289472 100644 --- a/doc/mdk_mixvm.texi +++ b/doc/mdk_mixvm.texi @@ -1,4 +1,4 @@ -@node mixvm, mixvm.el, Getting started, Top +@node mixvm, gmixvm, mixvm.el, Top @comment node-name, next, previous, up @chapter @code{mixvm}, the MIX computer simulator @@ -466,7 +466,7 @@ input-output devices this creation can be accomplished by a MIXAL program writing to the device the required data, or, if you prefer, with your favourite editor). -@multitable {the device name} {xx-xx} {filena[x-x].dev} {bin i/o} +@multitable {the device name} { xx-xx } {filename[x-x].dev} {bin i/o } @item @emph{Device} @tab @emph{No.} @tab @emph{filename} @tab @emph{type} @item Tape @tab 0-7 @tab @file{tape[0-7].dev} @tab bin i/o @item Disks @tab 8-15 @tab @file{disk[0-7].dev} @tab bin i/o diff --git a/doc/mdk_tut.texi b/doc/mdk_tut.texi index f1ff53e..12bfb42 100644 --- a/doc/mdk_tut.texi +++ b/doc/mdk_tut.texi @@ -1,4 +1,4 @@ -@node MIX and MIXAL tutorial, Getting started, Introduction, Top +@node MIX and MIXAL tutorial, Getting started, Installing MDK, Top @comment node-name, next, previous, up @chapter MIX and MIXAL tutorial @cindex MIX diff --git a/mixutils/mixvm_command.c b/mixutils/mixvm_command.c index 516bd68..e1c03bf 100644 --- a/mixutils/mixvm_command.c +++ b/mixutils/mixvm_command.c @@ -24,8 +24,15 @@ #include <stdio.h> #include <stdlib.h> #include <ctype.h> -#include <readline/readline.h> -#include <readline/history.h> + +#include <mixlib/mix.h> + +#ifdef HAVE_LIBREADLINE +# include <readline/readline.h> +# include <readline/history.h> +#else + typedef int Function (); +#endif /* HAVE_LIBREADLINE */ #include <mixlib/mix_vm.h> #include <mixlib/mix_vm_dump.h> @@ -70,6 +77,7 @@ static const char *mix_commands_[ALL_COMMANDS_NO_] = {NULL}; +#ifdef HAVE_LIBREADLINE /* readline functions */ static char * mixvm_cmd_generator_ (char *text, int state); @@ -125,6 +133,7 @@ mixvm_cmd_generator_ (char *text, int state) /* If no names matched, then return NULL. */ return ((char *)NULL); } +#endif /* HAVE_LIBREADLINE */ /* command functions */ static COMMAND * @@ -281,8 +290,12 @@ mixvm_cmd_init (char *arg, gboolean use_emacs) for (k = 0; k < MIX_CMD_INVALID; ++k) mix_commands_[k + LOCAL_COMANDS_NO_] = mix_vm_command_to_string (k); mix_commands_[ALL_COMMANDS_NO_ - 1] = NULL; + +#ifdef HAVE_LIBREADLINE /* Tell the completer that we want a crack first. */ rl_attempted_completion_function = (CPPFunction *)mixvm_cmd_completion_; +#endif /* HAVE_LIBREADLINE */ + /* initialise the dispatcher */ dis_ = mix_vm_cmd_dispatcher_new (stdout, stderr); diff --git a/mixutils/mixvm_loop.c b/mixutils/mixvm_loop.c index 8a571d8..a565832 100644 --- a/mixutils/mixvm_loop.c +++ b/mixutils/mixvm_loop.c @@ -20,13 +20,33 @@ */ +#define _GNU_SOURCE 1 +#include <stdio.h> #include <mixlib/mix.h> -#include <stdio.h> -#include <readline/readline.h> -#include <readline/history.h> #include "mixvm_command.h" +#ifdef HAVE_LIBHISTORY +# include <readline/history.h> +#else +# define add_history(x) ((void)0) +#endif + +#ifdef HAVE_LIBREADLINE +# include <readline/readline.h> +#else /* !HAVE_LIBREADLINE */ +static char * +readline (char *prompt) +{ + char *line = NULL; + size_t s = 0; + + printf ("%s", prompt); + getline (&line, &s, stdin); + return line; +} +#endif /* HAVE_LIBREADLINE */ + /* A static variable for holding the line. */ static char *line_read = (char *)NULL; static const char *PROMPT = N_("MIX > "); |