1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
|
;; -*-scheme-*- -------------- mixguile-commands.scm :
; mixvm commands implementation using the mixvm-cmd primitive
; ------------------------------------------------------------------
; Copyright (C) 2001, 2006, 2007 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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) (mixvm-cmd "sreg" (string-append (argsym->string reg)
" "
(argnum->string val)))))
; pmem
(define mix-pmem
(lambda (from . to)
(cond ((null? to) (mixvm-cmd "pmem" (argnum->string from)))
(else (mixvm-cmd "pmem"
(string-append (argnum->string from)
"-"
(argnnum->string to)))))))
; smem
(define mix-smem
(lambda (cell val) (mixvm-cmd "smem" (string-append (argnum->string cell)
" "
(argnum->string val)))))
; 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)
(mixvm-cmd "sover" (if val "T" "F"))))
; 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))))
; pstat
(define mix-pstat (lambda () (mixvm-cmd "pstat" "")))
; compile
(define mix-compile
(lambda (. file)
(mixvm-cmd "compile" (argnsym->string file))))
; devdir
(define mix-sddir
(lambda (dir)
(mixvm-cmd "sddir" dir)))
(define mix-pddir (lambda () (mixvm-cmd "pddir" "")))
; edit
(define mix-edit
(lambda (. file)
(mixvm-cmd "edit" (argnsym->string file))))
; help
(define mix-help
(lambda (. cmd)
(mixvm-cmd "help" (argnsym->string cmd))))
; 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))))
; sbp
(define mix-pline
(lambda (. no)
(mixvm-cmd "pline" (argnnum->string no))))
; 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-stime
(lambda (on)
(mixvm-cmd "stime" (if on "on" "off"))))
(define mix-ptime (lambda () (mixvm-cmd "ptime" "")))
; timing
(define mix-strace
(lambda (on)
(mixvm-cmd "strace" (if on "on" "off"))))
; logging
(define mix-slog
(lambda (on)
(mixvm-cmd "slog" (if on "on" "off"))))
; w2d
(define mix-w2d
(lambda (w)
(mixvm-cmd "w2d" w)));
; weval
(define mix-weval
(lambda (exp)
(mixvm-cmd "weval" (argsym->string exp))))
; pprog
(define mix-pprog (lambda () (mixvm-cmd "pprog" "")))
; sprog
(define mix-psrc (lambda () (mixvm-cmd "psrc" "")))
|