89
92
(declare (ignore real1 real2 run1 run2 gc1 gc2 gccount))
90
93
(dpb space1 (byte 24 24) space2)))
92
#-(or lispm cmu sbcl clisp)
95
#-(or lispm cmu scl sbcl clisp)
93
96
(defun used-area (&optional unused)
94
97
(declare (ignore unused))
97
(DEFUN CONTINUE (&OPTIONAL (input-stream *standard-input*)
99
(if (eql BATCH-OR-DEMO-FLAG :demo)
100
(format t "~% At the _ prompt, type ';' followed by enter to get next demo"))
115
(catch 'return-from-debugger
116
(when (not (checklabel $inchar))
100
(defun continue (&optional (input-stream *standard-input*)
102
(declare (special *socket-connection*))
103
(if (eql batch-or-demo-flag :demo)
104
(format t "~% At the _ prompt, type ';' followed by enter to get next demo~&"))
119
(catch 'return-from-debugger
120
(when (or (not (checklabel $inchar))
121
(not (checklabel $outchar)))
117
122
(setq $linenum (f1+ $linenum)))
118
#+akcl(si::reset-stack-limits)
119
(setq c-tag (makelabel $inchar))
120
(LET ((*MREAD-PROMPT* (if batch-or-demo-flag nil (MAIN-PROMPT)))
124
(SETQ R (dbm-read input-stream nil eof))
125
; This is something of a hack. If we are running in a server mode
126
; (which we determine by checking *socket-connection*) and we get
127
; an eof on an input-stream that is not *standard-input*, switch
128
; the input stream to *standard-input*.
129
; There should probably be a better scheme for server mode.
133
(not (eq input-stream *standard-input*))
134
(boundp '*socket-connection*))
136
(setq input-stream *standard-input*)
137
(setq *mread-prompt* nil)
138
(setq r (dbm-read input-stream nil eof))))
123
#+akcl(si::reset-stack-limits)
124
(setq c-tag (makelabel $inchar))
125
(let ((*mread-prompt* (if batch-or-demo-flag nil (main-prompt)))
129
(setq r (dbm-read input-stream nil eof))
130
;; This is something of a hack. If we are running in a server mode
131
;; (which we determine by checking *socket-connection*) and we get
132
;; an eof on an input-stream that is not *standard-input*, switch
133
;; the input stream to *standard-input*.
134
;; There should probably be a better scheme for server mode.
138
(not (eq input-stream *standard-input*))
139
(boundp '*socket-connection*))
141
(setq input-stream *standard-input*)
142
(setq *mread-prompt* nil)
143
(setq r (dbm-read input-stream nil eof))))
140
(cond ((and (eq r eof) (boundp '*socket-connection*)
141
(eq input-stream *socket-connection*))
142
(cond ((>= (setq eof-count (+ 1 eof-count)) 10)
143
(print "exiting on eof")
147
(cond ((and (consp r) (keywordp (car r)))
148
(break-call (car r) (cdr r) 'break-command)
154
(format t "~a" *general-display-prefix*)
155
(cond (#.writefilep ;write out the c line to the dribble file
156
(let ( (#.ttyoff t) smart-tty $linedisp)
157
(displa `((mlable) , c-tag , $__)))))
158
(IF (EQ R EOF) (RETURN '$DONE))
159
(fresh-line *standard-output*)
160
#+lispm (SEND *standard-output* :SEND-IF-HANDLES ':FORCE-OUTPUT)
163
(cond (batch-or-demo-flag
164
(displa `((mlable) ,c-tag , $__))))
165
(setq time-before (get-internal-run-time)
166
etime-before (get-internal-real-time))
167
(setq area-before (used-area))
168
(SETQ $% (TOPLEVEL-MACSYMA-EVAL $__))
169
(setq etime-after (get-internal-real-time)
170
time-after (get-internal-run-time))
171
(setq area-after (used-area))
172
(setq time-used (quotient (float (difference time-after time-before))
173
internal-time-units-per-second)
174
etime-used (quotient (float (difference etime-after etime-before))
175
internal-time-units-per-second))
176
(setq accumulated-time (plus accumulated-time time-used))
177
(SET (setq D-TAG (makelabel $outchar)) $%)
180
#+NIL (format t "~&Evaluation took ~$ seconds (~$ elapsed)."
181
time-used etime-used)
182
#-(or NIL cl) (mtell "Evaluation took ~S seconds (~S elapsed)."
183
time-used etime-used)
184
(format t "~&Evaluation took ~$ seconds (~$ elapsed)"
185
time-used etime-used )
186
#+lispm (format t "using ~A words." (f- area-after area-before))
187
#+(or cmu sbcl clisp)
145
(cond ((and (eq r eof) (boundp '*socket-connection*)
146
(eq input-stream *socket-connection*))
147
(cond ((>= (setq eof-count (+ 1 eof-count)) 10)
148
(print "exiting on eof")
151
(cond ((and (consp r) (keywordp (car r)))
152
(break-call (car r) (cdr r) 'break-command)
154
(format t "~a" *general-display-prefix*)
155
(cond (#.writefilep ;write out the c line to the dribble file
156
(let ( (#.ttyoff t) smart-tty $linedisp)
157
(displa `((mlable) , c-tag , $__)))))
158
(if (eq r eof) (return '$done))
160
(unless $nolabels (set c-tag $__))
161
(cond (batch-or-demo-flag
162
(displa `((mlable) ,c-tag , $__))))
163
(setq time-before (get-internal-run-time)
164
etime-before (get-internal-real-time))
165
(setq area-before (used-area))
166
(setq $% (toplevel-macsyma-eval $__))
167
(setq etime-after (get-internal-real-time)
168
time-after (get-internal-run-time))
169
(setq area-after (used-area))
170
(setq time-used (quotient
171
(float (difference time-after time-before))
172
internal-time-units-per-second)
174
(float (difference etime-after etime-before))
175
internal-time-units-per-second))
176
(setq accumulated-time (plus accumulated-time time-used))
177
(setq d-tag (makelabel $outchar))
178
(unless $nolabels (set d-tag $%))
181
(format t "Evaluation took ~$ seconds (~$ elapsed)"
182
time-used etime-used )
185
#+(or cmu scl sbcl clisp)
188
186
(let ((total-bytes (- area-after area-before)))
189
(cond ((> total-bytes 1024)
190
(format t " using ~,3F KB." (/ total-bytes 1024.0))
192
((> total-bytes (* 1024 1024))
193
(format t " using ~,3F MB." (/ total-bytes (* 1024.0 1024.0)))
187
(cond ((> total-bytes (* 1024 1024))
188
(format t " using ~,3F MB.~%"
189
(/ total-bytes (* 1024.0 1024.0))))
190
((> total-bytes 1024)
191
(format t " using ~,3F KB.~%" (/ total-bytes 1024.0)))
196
(format t " using ~:D bytes." total-bytes))))
203
(fresh-line *standard-output*)
204
#+never(let ((tem (read-char-no-hang)))
205
(or (eql tem #\newline) (and tem (unread-char tem))))
206
(IF (EQ (CAAR R) 'DISPLAYINPUT)
207
(DISPLA `((MLABLE) ,D-TAG ,$%)))
208
(when (eq batch-or-demo-flag ':demo)
209
(mtell "~&~A_~A" *prompt-prefix* *prompt-suffix*)
212
;;those are common lisp characters you'r reading here
214
(setq char (read-char *terminal-io*))
215
((#\page) (unless (cursorpos 'c input-stream) (terpri *standard-output*))
216
(princ "_" *standard-output*))
217
((#\?) (mtell " Pausing. Type a ';' and Enter to continue demo.~%_"))
218
((#\space #\; #\n #\e #\x #\t))
220
(if quitting (throw 'abort-demo nil) (return nil)))
223
;; This is sort of a kludge -- eat newlines and blanks so that they don't echo
224
(AND BATCH-OR-DEMO-FLAG
226
(send input-stream :operation-handled-p :read-char-no-echo)
228
(send input-stream :operation-handled-p :unread-char-no-echo)
230
(setq char (read-char input-stream nil #+cl nil))
232
;;;; INSERTED BY MASAMI
234
(throw 'MACSYMA-QUIT NIL))
237
(unless (zl-MEMBER char '(#\space #\newline #\return #\tab))
238
(unread-char char input-stream)
242
(DEFUN $BREAK (&REST ARG-LIST)
243
(PROG1 (apply #'$PRINT ARG-LIST)
248
(DEFUN MBREAK-LOOP ()
249
(LET ((*standard-input* #+nil (make-synonym-stream '*terminal-io*)
193
(format t " using ~:D bytes.~%" total-bytes)))))
195
(putprop d-tag (cons time-used 0) 'time))
196
(if (eq (caar r) 'displayinput)
197
(displa `((mlable) ,d-tag ,$%)))
198
(when (eq batch-or-demo-flag ':demo)
199
(mtell "~A_~A" *prompt-prefix* *prompt-suffix*)
202
;;those are common lisp characters you're reading here
204
(setq char (read-char *terminal-io*))
205
((#\page) (unless (cursorpos 'c input-stream)
206
(terpri *standard-output*))
207
(princ "_" *standard-output*))
208
((#\?) (mtell " Pausing. Type a ';' and Enter to continue demo.~%_"))
209
((#\space #\; #\n #\e #\x #\t))
211
(if quitting (throw 'abort-demo nil) (return nil)))
214
;; This is sort of a kludge -- eat newlines and blanks so that
216
(and batch-or-demo-flag
218
(setq char (read-char input-stream nil #+cl nil))
220
(throw 'macsyma-quit nil))
221
(unless (zl-member char '(#\space #\newline #\return #\tab))
222
(unread-char char input-stream)
226
(defun $break (&rest arg-list)
227
(prog1 (apply #'$print arg-list)
232
(defun mbreak-loop ()
233
(let ((*standard-input* #+nil (make-synonym-stream '*terminal-io*)
251
235
(*standard-output* *debug-io*))
253
(format t "~%Entering a Macsyma break point. Type EXIT; to resume")
237
(format t "~%Entering a Maxima break point. Type exit; to resume")
256
(SETQ R (CADDR (LET ((*MREAD-PROMPT* (BREAK-PROMPT)))
257
(MREAD *standard-input*))))
259
(($EXIT) (THROW 'BREAK-EXIT T))
260
(T (ERRSET (DISPLA (MEVAL R)) T)))))))
240
(setq r (caddr (let ((*mread-prompt* (break-prompt)))
241
(mread *standard-input*))))
243
(($exit) (throw 'break-exit t))
244
(t (errset (displa (meval r)) t)))))))
262
246
(defun merrbreak (&optional arg)
263
247
(format *debug-io* "~%Merrbreak:~A" arg)
267
(DEFUN RETRIEVE (MSG FLAG &AUX (PRINT? NIL))
268
(DECLARE (SPECIAL MSG FLAG PRINT?))
269
(OR (EQ FLAG 'NOPRINT) (SETQ PRINT? T))
272
#'(LAMBDA (STREAM CHAR) STREAM CHAR
273
(COND ((NOT PRINT?) (SETQ PRINT? T))
275
((ATOM MSG) (PRINC MSG) (MTERPRI))
276
((EQ FLAG T) (MAPC #'PRINC (CDR MSG)) (MTERPRI))
277
(T (DISPLA MSG) (MTERPRI)))))))
251
(defun retrieve (msg flag &aux (print? nil))
252
(declare (special msg flag print?))
253
(or (eq flag 'noprint) (setq print? t))
256
#'(lambda (stream char) stream char
257
(cond ((not print?) (setq print? t))
259
((atom msg) (princ msg) (mterpri))
260
((eq flag t) (mapc #'princ (cdr msg)) (mterpri))
261
(t (displa msg) (mterpri)))))))
279
(DEFUN RETRIEVE (MSG FLAG &AUX (PRINT? NIL))
280
(DECLARE (SPECIAL MSG FLAG PRINT?))
281
(OR (EQ FLAG 'NOPRINT) (SETQ PRINT? T))
284
(princ *prompt-prefix*)
285
(princ *prompt-suffix*))
287
(princ *prompt-prefix*)
288
(princ *prompt-suffix*))
290
(format t "~a~a~a" *prompt-prefix* MSG *prompt-suffix*)
263
(defun retrieve (msg flag &aux (print? nil))
264
(declare (special msg flag print?))
265
(or (eq flag 'noprint) (setq print? t))
268
(princ *prompt-prefix*)
269
(princ *prompt-suffix*))
271
(princ *prompt-prefix*)
272
(princ *prompt-suffix*))
274
(format t "~a~a~a" *prompt-prefix* msg *prompt-suffix*)
293
277
(princ *prompt-prefix*)
294
(MAPC #'PRINC (CDR MSG))
278
(mapc #'princ (cdr msg))
295
279
(princ *prompt-suffix*)
298
282
(princ *prompt-prefix*)
300
284
(princ *prompt-suffix*)
302
(mread-noprompt *query-io* nil))
305
(DEFMFUN $READ (&REST L)
306
(MEVAL (APPLY #'$READONLY L)))
308
(DEFMFUN $READONLY (&REST L)
286
(let ((res (mread-noprompt *query-io* nil)))
287
(princ *general-display-prefix*) res))
290
(defmfun $read (&rest l)
291
(meval (apply #'$readonly l)))
293
(defmfun $readonly (&rest l)
309
294
(let ((*mread-prompt*
310
295
(if l (string-right-trim '(#\n)
311
296
(with-output-to-string (*standard-output*)
312
297
(apply '$print l))) "")))
313
298
(setf *mread-prompt* (format nil "~a~a~a" *prompt-prefix* *mread-prompt*
315
300
(setf answer (third (mread *query-io*)))))
319
(DEFUN MREAD-TERMINAL (PROMPT)
320
(prog1 (let (#+NIL (si:*ttyscan-dispatch-table *macsyma-ttyscan-operators*))
321
(CADDR (send *terminal-io* ':RUBOUT-HANDLER
322
`((:PROMPT ,PROMPT) #+NIL (:reprompt ,prompt))
323
#'MREAD-RAW *terminal-io*)))
324
(fresh-line *terminal-io*)))
328
(DEFUN MAKE-INPUT-STREAM (X Y) Y ;ignore
331
(DEFUN BATCH (FILENAME &OPTIONAL DEMO-P
332
&AUX (orig filename )
304
;;(DEFUN MREAD-TERMINAL (PROMPT)
305
;; (prog1 (let (#+NIL (si:*ttyscan-dispatch-table *macsyma-ttyscan-operators*))
306
;; (CADDR (send *terminal-io* ':RUBOUT-HANDLER
307
;; `((:PROMPT ,PROMPT) #+NIL (:reprompt ,prompt))
308
;; #'MREAD-RAW *terminal-io*)))
309
;; (fresh-line *terminal-io*)))
312
(defun make-input-stream (x y) y ;ignore
315
(defun batch (filename &optional demo-p
316
&aux (orig filename )
334
FILE-OBJ (accumulated-time 0.0) (abortp t))
318
file-obj (accumulated-time 0.0) (abortp t))
335
319
(setq list (if demo-p '$file_search_demo '$file_search_maxima))
336
320
(setq filename ($file_search filename (symbol-value list)))
337
321
(or filename (merror "Could not find ~M in ~M: ~M"
338
322
orig list (symbol-value list)))
341
(progn (batch-internal (setq file-obj (open filename)) demo-p)
344
(format t "~&Batch spent ~$ seconds in evaluation.~%"
346
(IF FILE-OBJ (CLOSE FILE-OBJ))
325
(progn (batch-internal (setq file-obj (open filename)) demo-p)
328
(format t "~&Batch spent ~$ seconds in evaluation.~%"
330
(if file-obj (close file-obj))
347
331
(when abortp (format t "~&(Batch of ~A aborted.)~%" filename))))
350
334
(defun batch-internal (fileobj demo-p)
351
(CONTINUE (MAKE-ECHO-INPUT-STREAM
352
(MAKE-INPUT-STREAM fileobj "Batch Input Stream"))
353
(IF DEMO-P ':DEMO ':BATCH)))
335
(continue (make-echo-stream
336
(make-input-stream fileobj "Batch Input Stream")
338
(if demo-p ':demo ':batch)))
355
(DEFUN $BATCH (&REST ARG-LIST)
356
(BATCH (FILENAME-FROM-ARG-LIST ARG-LIST) NIL))
340
(defun $batch (&rest arg-list)
341
(batch (filename-from-arg-list arg-list) nil))
358
(DEFUN FILENAME-FROM-ARG-LIST (ARG-LIST)
359
(IF (= (LENGTH ARG-LIST) 1)
360
($FILENAME_MERGE (CAR ARG-LIST))
361
($FILENAME_MERGE `((MLIST),@ARG-LIST))))
343
(defun filename-from-arg-list (arg-list)
344
(if (= (length arg-list) 1)
345
($filename_merge (car arg-list))
346
($filename_merge `((mlist),@arg-list))))
363
348
(defmspec $grindef (form)
364
349
(eval `(grindef ,@(cdr form)))
367
(DEFUN $DEMO (&REST ARG-LIST)
353
(defun $demo (&rest arg-list)
368
354
(let ((tem ($file_search (car arg-list) $file_search_demo)))
369
355
(or tem (merror "Could not find ~M in ~M: ~M" (car arg-list) '$file_search_demo $file_search_demo ))
370
($BATCH tem '$demo)))
356
($batch tem '$demo)))
373
(DEFUN $DEMO (&REST ARG-LIST)
374
(BATCH (FILENAME-FROM-ARG-LIST ARG-LIST) T))
359
(defun $demo (&rest arg-list)
360
(batch (filename-from-arg-list arg-list) t))
376
362
(defmfun $bug_report ()
377
363
(format t "~%The Maxima bug database is available at~%")
400
386
(defvar *maxima-started* nil)
401
387
(defvar *maxima-prolog* "")
402
388
(defvar *maxima-epilog* "")
403
(defun meshugena-clisp-banner ()
404
(format t " i i i i i i i ooooo o ooooooo ooooo ooooo~%")
405
(format t " I I I I I I I 8 8 8 8 8 o 8 8~%")
406
(format t " I \\ `+' / I 8 8 8 8 8 8~%")
407
(format t " \\ `-+-' / 8 8 8 ooooo 8oooo~%");
408
(format t " `-__|__-' 8 8 8 8 8~%")
409
(format t " | 8 o 8 8 o 8 8~%")
410
(format t " ------+------ ooooo 8oooooo ooo8ooo ooooo 8~%")
412
(format t "Copyright (c) Bruno Haible, Michael Stoll 1992, 1993~%")
413
(format t "Copyright (c) Bruno Haible, Marcus Daniels 1994-1997~%")
414
(format t "Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998~%")
415
(format t "Copyright (c) Bruno Haible, Sam Steingold 1999-2003~%")
417
"--------------------------------------------------------------~%~%"))
390
(defvar *maxima-quiet* nil)
420
(defun macsyma-top-level (&OPTIONAL (input-stream *standard-input*)
393
(defun macsyma-top-level (&optional (input-stream *standard-input*)
422
(let ((*package* (find-package "MAXIMA")))
395
(let ((*package* (find-package :maxima)))
423
396
(if *maxima-started*
424
397
(format t "Maxima restarted.~%")
426
#+clisp (meshugena-clisp-banner)
427
(format t *maxima-prolog*)
428
(format t "~&Maxima ~a http://maxima.sourceforge.net~%"
430
(format t "Using Lisp ~a ~a" (lisp-implementation-type)
431
#-clisp (lisp-implementation-version)
432
#+clisp (subseq (lisp-implementation-version)
434
")" (lisp-implementation-version)))))
435
#+gcl (format t " (aka GCL)")
437
(format t "Distributed under the GNU Public License. See the file COPYING.~%")
438
(format t "Dedicated to the memory of William Schelter.~%")
439
(format t "This is a development version of Maxima. The function bug_report()~%")
440
(format t "provides bug reporting information.~%")
399
(if (not *maxima-quiet*) (maxima-banner))
441
400
(setq *maxima-started* t)))
442
401
(if ($file_search "maxima-init.lisp") ($load ($file_search "maxima-init.lisp")))
443
402
(if ($file_search "maxima-init.mac") ($batchload ($file_search "maxima-init.mac")))
445
404
(catch 'quit-to-lisp
446
(in-package "MAXIMA")
449
(catch #+kcl si::*quit-tag* #+(or cmu sbcl) 'continue #-(or kcl cmu sbcl) nil
408
(catch #+kcl si::*quit-tag* #+(or cmu scl sbcl) 'continue #-(or kcl cmu scl sbcl) nil
450
409
(catch 'macsyma-quit
451
410
(continue input-stream batch-flag)
452
411
(format t *maxima-epilog*)
414
(defun maxima-banner ()
415
(format t *maxima-prolog*)
416
(format t "~&Maxima ~a http://maxima.sourceforge.net~%"
418
(format t "Using Lisp ~a ~a" (lisp-implementation-type)
419
#-clisp (lisp-implementation-version)
420
#+clisp (subseq (lisp-implementation-version)
422
")" (lisp-implementation-version)))))
423
#+gcl (format t " (aka GCL)")
425
(format t "Distributed under the GNU Public License. See the file COPYING.~%")
426
(format t "Dedicated to the memory of William Schelter.~%")
427
(format t "This is a development version of Maxima. The function bug_report()~%")
428
(format t "provides bug reporting information.~%"))
459
(si::putprop :t 'throw-macsyma-top 'si::break-command)
461
(defun throw-macsyma-top ()
462
(throw 'macsyma-quit t))
465
(defmfun $writefile (x) (dribble (subseq (string x) 1)))
466
(defvar $appendfile nil )
467
(defmfun $appendfile (name)
468
(if (and (symbolp name)
469
(member (getcharn name 1) '(#\& #\$)))
470
(setq name (subseq (symbol-name name) 1)))
471
(if $appendfile (merror "already in appendfile, use closefile first"))
472
(let ((stream (open name :direction :output
474
:if-does-not-exist :create)))
475
(setq *appendfile-data* (list stream *terminal-io* name ))
477
(setq $appendfile (make-two-way-stream
478
(make-echo-stream *terminal-io* stream)
479
(make-broadcast-stream *terminal-io* stream))
480
*terminal-io* $appendfile)
481
(multiple-value-bind (sec min hour day month year)
484
"~&/* Starts dribbling to ~A (~d/~d/~d, ~d:~d:~d).*/"
485
name year month day hour min sec))
488
(defmfun $closefile ()
434
(si::putprop :t 'throw-macsyma-top 'si::break-command)
436
(defun throw-macsyma-top ()
437
(throw 'macsyma-quit t))
440
(defmfun $writefile (x) (dribble (maxima-string x)))
442
(defvar $appendfile nil )
444
(defvar *appendfile-data*)
446
(defmfun $appendfile (name)
447
(if (and (symbolp name)
448
(member (getcharn name 1) '(#\& #\$)))
449
(setq name (maxima-string name)))
450
(if $appendfile (merror "already in appendfile, use closefile first"))
451
(let ((stream (open name :direction :output
453
:if-does-not-exist :create)))
454
(setq *appendfile-data* (list stream *terminal-io* name ))
456
(setq $appendfile (make-two-way-stream
457
(make-echo-stream *terminal-io* stream)
458
(make-broadcast-stream *terminal-io* stream))
459
*terminal-io* $appendfile)
460
(multiple-value-bind (sec min hour day month year)
463
"~&/* Starts dribbling to ~A (~d/~d/~d, ~d:~d:~d).*/"
464
name year month day hour min sec))
467
(defmfun $closefile ()
491
(cond ((eq $appendfile *terminal-io*)
492
(format t "~&/*Finished dribbling to ~A.*/"
493
(nth 2 *appendfile-data*))
494
(setq *terminal-io* (nth 1 *appendfile-data*))
496
(t (warn "*TERMINAL-IO* was rebound while APPENDFILE is on.~%~
470
(cond ((eq $appendfile *terminal-io*)
471
(format t "~&/*Finished dribbling to ~A.*/"
472
(nth 2 *appendfile-data*))
473
(setq *terminal-io* (nth 1 *appendfile-data*))
475
(t (warn "*TERMINAL-IO* was rebound while APPENDFILE is on.~%~
497
476
You may miss some dribble output.")))
498
(close (nth 0 *appendfile-data*))
499
(setq *appendfile-data* nil $appendfile nil)
477
(close (nth 0 *appendfile-data*))
478
(setq *appendfile-data* nil $appendfile nil)
505
(defmfun $ed (x) (ed (subseq (string x) 1)))
507
(defmfun $cli () (process ":CLI.PR"))
509
(defun nsubstring (x y) (subseq x y))
511
(defun filestrip (x) (subseq (string (car x)) 1))
514
(defmspec $with_stdout ( arg) (setq arg (cdr arg))
515
(let ((body (cdr arg)) res)
516
(with-open-file (*standard-output* (NAMESTRING (maxima-string (car arg)))
519
(setq res (meval* v)))
484
(defmfun $ed (x) (ed (maxima-string x)))
486
(defmfun $cli () (merror "Not implemented!") )
488
(defun nsubstring (x y) (subseq x y))
490
(defun filestrip (x) (subseq (print-invert-case (car x)) 1))
493
(defmspec $with_stdout (arg)
496
((fname (namestring (maxima-string (car arg))))
498
(if (or (eq $file_output_append '$true) (eq $file_output_append t))
499
`(*standard-output* ,fname :direction :output :if-exists :append :if-does-not-exist :create)
500
`(*standard-output* ,fname :direction :output :if-exists :supersede :if-does-not-exist :create))))
502
`(with-open-file ,filespec
503
(let ((body ',(cdr arg)) res)
505
(setq res (meval* v)))
524
508
(defun $sconcat(&rest x)
527
(setq ans (concatenate 'string ans
511
(setq ans (concatenate 'string ans
529
(cond ((and (symbolp v) (eql (getcharn v 1)
531
(subseq (symbol-name v) 1))
534
(coerce (mstring v) 'string))))))
513
(cond ((and (symbolp v) (eql (getcharn v 1)
515
(subseq (print-invert-case v) 1))
518
(coerce (mstring v) 'string))))))
539
(defun $system (&rest x) (system (apply '$sconcat x)))
542
(defun $system (&rest x) (ext:run-shell-command (apply '$sconcat x)))
545
(defun $system (&rest args)
546
(ext:run-program "/bin/sh" (list "-c" (apply '$sconcat args)) :output t))
549
(defun $system (&rest args)
550
(excl:run-shell-command (apply '$sconcat args) :wait t))
553
(defun $system (&rest args)
554
(sb-ext:run-program "/bin/sh" (list "-c" (apply '$sconcat args)) :output t))
557
(defun $system (&rest args)
558
(ccl::run-program "/bin/sh" (list "-c" (apply '$sconcat args)) :output t))
522
(defun $system (&rest args)
523
#+gcl (lisp:system (apply '$sconcat args))
524
#+clisp (ext:run-shell-command (apply '$sconcat args))
525
#+(or cmu scl) (ext:run-program "/bin/sh"
526
(list "-c" (apply '$sconcat args)) :output t)
527
#+allegro (excl:run-shell-command (apply '$sconcat args) :wait t)
528
#+sbcl (sb-ext:run-program "/bin/sh"
529
(list "-c" (apply '$sconcat args)) :output t)
530
#+openmcl (ccl::run-program "/bin/sh"
531
(list "-c" (apply '$sconcat args)) :output t)
560
534
(defun $room (&optional (arg nil arg-p))