help-- using writefile in winXP



Doug Stewart  writes:

> Wolfgang Jenkner wrote:
>>:lisp (boundp '*socket-connection*)
>>
>>If this returns T [...] the problem is likely explained by what I
>>said above.
>
> yes it does.
> So this is fixed ?
> how do I get the fix?

The fix I mentioned is part of a somewhat larger change, which
concerns only the development sources in CVS (and I haven't even
committed it yet), see

http://www.math.utexas.edu/pipermail/maxima/2005/009681.html

However, for your specific problem, it is enough to redefine a single
function.  The problem is that, in this special case, this must happen
before Maxima is started via (RUN), so I would suggest to make a new
image.  I am assuming that you have some binary-only distribution,
which, by definition, doesn't let you rebuild Maxima from sources.

I can only tell how this can be done on a Unix-like system.  Perhaps,
somebody else will give the details of how this is supposed to work on
Windows.

(1) Change to the directory which contains the maxima image, a binary
    file normally called `maxima'.

(2) Rename the image to `maxima_ori'.

(3) Put the following code in some file, say `patch1.lsp'.

;;; Begin code
(in-package "MAXIMA")

#+gcl
(defun setup-server (port &optional (host "localhost"))
  (let ((stream (open-socket host port)))
    (check-type stream stream)
    (setq si::*sigpipe-action* 'si::bye)
    (setq *socket-connection* stream)
    (setq *terminal-io* stream)
    (format t "pid=~a~%" (getpid))
    (force-output)
    (values)))

#+gcl
(defmacro save-stuff ()
  `(progn
     ,(let ((sym (find-symbol "SGC-ON" "SI")))
	(when (and sym (fboundp sym))
	  `(,sym t)))
     (si:save-system "maxima_new")))
;;; End code

(4) ./maxima_ori -load patch1.lsp -eval "(maxima::save-stuff)" 

(5) The last step should have created a file `maxima_new'.  Rename it
    to `maxima'.

That's it.  Just start maxima in the usual way.  If it doesn't work
correctly, just rename `maxima_ori' to `maxima'.

Wolfgang