summaryrefslogtreecommitdiffhomepage
path: root/mixguile
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2001-08-23 00:01:08 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2001-08-23 00:01:08 +0000
commit6446df78afb4f3da2aa90e25b18b471fb272a8a9 (patch)
tree12d538e5fbb4cb34eac5a0f0776eb728a159ecef /mixguile
parent2f80c2ddcae154ab3cd7dac3cd60c03285c00265 (diff)
downloadmdk-6446df78afb4f3da2aa90e25b18b471fb272a8a9.tar.gz
mdk-6446df78afb4f3da2aa90e25b18b471fb272a8a9.tar.bz2
mixguile commands
Diffstat (limited to 'mixguile')
-rw-r--r--mixguile/.cvsignore1
-rw-r--r--mixguile/Makefile.am19
-rw-r--r--mixguile/mixguile-commands.scm227
-rw-r--r--mixguile/mixguile.scm24
-rw-r--r--mixguile/mixguile_main.c4
5 files changed, 272 insertions, 3 deletions
diff --git a/mixguile/.cvsignore b/mixguile/.cvsignore
index e995588..fd2e71f 100644
--- a/mixguile/.cvsignore
+++ b/mixguile/.cvsignore
@@ -1,3 +1,4 @@
.deps
Makefile
Makefile.in
+mixguile
diff --git a/mixguile/Makefile.am b/mixguile/Makefile.am
index 664c7cd..392b08d 100644
--- a/mixguile/Makefile.am
+++ b/mixguile/Makefile.am
@@ -10,16 +10,33 @@
# 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\"
+
+SCM_FILES = mixguile.scm mixguile-commands.scm
+EXTRA_DIST = $(SCM_FILES)
noinst_LIBRARIES = libmixguile.a
if MAKE_GUILE
+
+SCM_PATHS = -DSCM_FILE=\""$(pkgdatadir)/mixguile.scm"\"\
+ -DLOCAL_SCM_FILE=\"mixguile.scm\"
+
+pkgdata_DATA = $(SCM_FILES)
+
+libmixguile_a_INCLUDES = -I$(includedir) -DG_LOG_DOMAIN=\"libmixguile\"
libmixguile_a_SOURCES = mixguile.h mixguile.c \
mixguile_cmd_dispatcher.h mixguile_cmd_dispatcher.c \
xmixguile_cmd_dispatcher.h xmixguile_cmd_dispatcher.c
+bin_PROGRAMS = mixguile
+mixguile_INCLUDES = -I$(includedir) $(SCM_PATHS)
+mixguile_LDADD = $(top_builddir)/mixlib/libmix.a \
+ $(top_builddir)/lib/libreplace.a \
+ $(top_builddir)/mixguile/libmixguile.a $(INTLLIBS)
+mixguile_SOURCES = mixguile_main.c
+
else
+
libmixguile_a_SOURCES =
endif
diff --git a/mixguile/mixguile-commands.scm b/mixguile/mixguile-commands.scm
new file mode 100644
index 0000000..2615179
--- /dev/null
+++ b/mixguile/mixguile-commands.scm
@@ -0,0 +1,227 @@
+;; -*-scheme-*- -------------- mixguile-commands.scm :
+; mixvm commands implementation using the mixvm-cmd primitive
+; ------------------------------------------------------------------
+; Last change: Time-stamp: "01/08/23 00:15:59 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.
+;
+;;
+
+;; auxiliar functions for argument conversion
+(define argsym->string
+ (lambda (arg)
+ (cond ((symbol? arg) (symbol->string arg))
+ ((string? arg) arg)
+ (else (error "Wrong argument type" arg)))))
+
+(define argnsym->string
+ (lambda (arg)
+ (cond ((null? arg) "")
+ ((pair? arg) (argsym->string (car arg)))
+ (else (argsym->string arg)))))
+
+(define argnum->string
+ (lambda (arg)
+ (cond ((number? arg) (number->string arg))
+ ((string? arg) arg)
+ (else (error "Wrong argument type" arg)))))
+
+(define argnnum->string
+ (lambda (arg)
+ (cond ((null? arg) "")
+ ((pair? arg) (argnum->string (car arg)))
+ (else (argnum->string arg)))))
+
+;;; mixvm commands
+
+; preg
+(define mix-preg
+ (lambda (. reg)
+ (mixvm-cmd "preg" (argnsym->string reg))))
+
+; sreg
+(define mix-sreg
+ (lambda (reg val) (mix-set-reg! reg val)))
+
+; pmem
+(define mix-pmem
+ (lambda (no)
+ (mixvm-cmd "pmem" (argnum->string no))))
+
+; smem
+(define mix-smem
+ (lambda (cell value) (mix-set-cell! cell value)))
+
+; pall
+(define mix-pall (lambda () (mixvm-cmd "pall" "")))
+
+; pc
+(define mix-pc (lambda () (mixvm-cmd "pc" "")))
+
+; pflags
+(define mix-pflags (lambda () (mixvm-cmd "pflags" "")))
+
+; sover
+(define mix-sover
+ (lambda (val)
+ (let ((bval (if val #t #f)))
+ (mix-set-over! bval))))
+
+; psym
+(define mix-psym
+ (lambda (. sym)
+ (mixvm-cmd "psym" (argnsym->string sym))))
+
+; ssym
+(define mix-ssym
+ (lambda (sym value)
+ (mixvm-cmd "ssym"
+ (string-append
+ (argsym->string sym) " " (argnum->string value)))))
+
+; run
+(define mix-run
+ (lambda (. file)
+ (mixvm-cmd "run" (argnsym->string file))))
+
+; next
+(define mix-next
+ (lambda (. no)
+ (mixvm-cmd "next" (argnnum->string no))))
+
+; load
+(define mix-load
+ (lambda (file)
+ (mixvm-cmd "load" (argsym->string file))))
+
+; compile
+(define mix-compile
+ (lambda (. file)
+ (mixvm-cmd "compile" (argnsym->string file))))
+
+; devdir
+(define mix-devdir
+ (lambda (. dir)
+ (mixvm-cmd "devdir" (argnsym->string dir))))
+
+; edit
+(define mix-edit
+ (lambda (. file)
+ (mixvm-cmd "edit" (argnsym->string file))))
+
+; help
+(define mix-help
+ (lambda (. cmd)
+ (mixvm-cmd "help" (argnsym->string help))))
+
+; pasm
+(define mix-pasm (lambda () (mixvm-cmd "pasm" "")))
+
+; sasm
+(define mix-sasm
+ (lambda (path)
+ (mixvm-cmd "sasm" (argsym->string path))))
+
+; pedit
+(define mix-pedit (lambda () (mixvm-cmd "pedit" "")))
+
+; sedit
+(define mix-sedit
+ (lambda (path)
+ (mixvm-cmd "sedit" (argsym->string path))))
+
+; sbp
+(define mix-sbp
+ (lambda (line)
+ (mixvm-cmd "sbp" (argnum->string line))))
+
+; cbp
+(define mix-cbp
+ (lambda (line)
+ (mixvm-cmd "cbp" (argnum->string line))))
+
+; sbpa
+(define mix-sbpa
+ (lambda (addr)
+ (mixvm-cmd "sbpa" (argnum->string addr))))
+
+; cbpa
+(define mix-cbpa
+ (lambda (addr)
+ (mixvm-cmd "cbpa" (argnum->string addr))))
+
+
+; sbpc
+(define mix-sbpc (lambda () (mixvm-cmd "sbpc" "")))
+
+; cbpc
+(define mix-cbpc (lambda () (mixvm-cmd "cbpc" "")))
+
+; sbpo
+(define mix-sbpo (lambda () (mixvm-cmd "sbpo" "")))
+
+; cbpo
+(define mix-cbpo (lambda () (mixvm-cmd "cbpo" "")))
+
+; sbpm
+(define mix-sbpm
+ (lambda (cell)
+ (mixvm-cmd "sbpm" (argnum->string cell))))
+
+; cbpm
+(define mix-cbpm
+ (lambda (cell)
+ (mixvm-cmd "cbpm" (argnum->string cell))))
+
+; sbpr
+(define mix-sbpr
+ (lambda (reg)
+ (mixvm-cmd "sbpr" (argsym->string reg))))
+
+; cbpr
+(define mix-cbpr
+ (lambda (reg)
+ (mixvm-cmd "cbpr" (argsym->string reg))))
+
+; pbt
+(define mix-pbt
+ (lambda (. num)
+ (mixvm-cmd "pbt" (argnnum->string num))))
+
+; timing
+(define mix-timing
+ (lambda (. on)
+ (mixvm-cmd "timing" (cond ((null? on) "")
+ (on "on")
+ (else "off")))))
+
+; timing
+(define mix-tracing
+ (lambda (. on)
+ (mixvm-cmd "tracing" (cond ((null? on) "")
+ (on "on")
+ (else "off")))))
+
+; w2d
+(define mix-w2d
+ (lambda (w)
+ (mixvm-cmd "w2d" w)));
+
+; weval
+(define mix-weval
+ (lambda (exp)
+ (mixvm-cmd "weval" (argsym->string exp))))
diff --git a/mixguile/mixguile.scm b/mixguile/mixguile.scm
new file mode 100644
index 0000000..664c61b
--- /dev/null
+++ b/mixguile/mixguile.scm
@@ -0,0 +1,24 @@
+;; -*-scheme-*- -------------- mixguile.scm :
+; mixguile bootstrap file
+; ------------------------------------------------------------------
+; Last change: Time-stamp: "01/08/23 00:16:53 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.
+;
+;;
+
+(load "mixguile-commands.scm")
diff --git a/mixguile/mixguile_main.c b/mixguile/mixguile_main.c
index 46a35f1..de9bfa4 100644
--- a/mixguile/mixguile_main.c
+++ b/mixguile/mixguile_main.c
@@ -1,4 +1,4 @@
-/* -*-c-*- -------------- mixguile.c :
+/* -*-c-*- -------------- mixguile_main.c :
* Main function for mixguile, the MIX Guile shell
* ------------------------------------------------------------------
* Last change: Time-stamp: "01/08/22 01:20:01 jao"
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <stdio.h>
-#include <mixguile/mixguile.h>
+#include "mixguile.h"
static void
inner_main_ (int argc, char *argv[])