[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Gcl-devel] japi

From: Mike Thomas
Subject: RE: [Gcl-devel] japi
Date: Thu, 9 Oct 2003 09:32:44 +1000

Hi Jacques.

| So, Mike, I have tried "japi" and it seems to work

Great.  As far as I know, you're the first person other than me to use it so
take that as a warning!

| I am in a rush now to start a new project
| I need
|   - a correct execution speed (that means compiled lisp code)
|   - lisp code compilation on different platforms (XP, Linux, ...)
|   - some graphic capabilities (maybe "japi" will make the trick)

It sounds to me as if GCL should be worth a try - don't write off CLISP

>From earlier emails, you seem to be happy to try off-beat languages, so if
you are prepared to try Haskell, the GHC compiler has excellent cross
platform compiler and library support.

| Can GCL support any kind of socket type of communication with
| other processes ?

Yes, although it is not very sophisticated.  Maxima works with the XMaxima
interface through sockets and GCL and CLISP are used to build Maxima
commonly.  I've included the Maxima server socket code below as an example.

| Can GCL be turned as a standalone executable for a given platforms
| without telling anybody that it is GCL (probably by generating some
| kind of overall GCL images) ?

I'm not sure what you're asking here.

If you are asking whether GCL can be used to build a standalone executable,
then "Yes." but I'm not sure how to turn off the startup message without
rebuilding from source - it is proabably possible.  Again, Maxima and ACL2
are built this way.

| I am a kind of stressed to start with something I do not know well

I guess you should work with something familiar if your project is really
important to you.

The GCL development team aims to help GCL users as much as possible, but I
am personally unable to put as much time as needed into the Windows port and
everyone else on the project is a voluntary worker too although somewhat
more engaged with the project than myself!


Mike Thomas.


;; very simple server started on port

(and (find-package "MAXIMA") (push :maxima *features*))

(in-package "MAXIMA")

(defun user::setup ( port &optional (host "localhost"))
  (let* ((sock (open-socket host port)))
    (setq me sock)
   #+gcl (setq si::*sigpipe-action* 'si::bye)
    (setq *socket-connection* sock)
    (setq *standard-input* sock)
    (setq *standard-output* sock)
    (setq *error-output* sock)
    (setq *terminal-io* sock)
    (format t "pid=~a~%"        (getpid))
    (force-output sock)
    (setq *debug-io* sock)

;;; from CLOCC: <http://clocc.sourceforge.net>
(defun open-socket (host port &optional bin)
  "Open a socket connection to HOST at PORT."
  (declare (type (or integer string) host) (fixnum port) (type boolean bin))
  (let ((host (etypecase host
                (string host)
                (integer (hostent-name (resolve-host-ipaddr host))))))
    #+allegro (socket:make-socket :remote-host host :remote-port port
                                  :format (if bin :binary :text))
    #+clisp (socket-connect port host :element-type
                                 (if bin '(unsigned-byte 8) 'character))

    #+cmu (sys:make-fd-stream (ext:connect-to-inet-socket host port)
                              :input t :output t :element-type
                              (if bin '(unsigned-byte 8) 'character))
    #+gcl (si::socket port :host host)
    #+lispworks (comm:open-tcp-stream host port :direction :io :element-type
                                      (if bin 'unsigned-byte 'base-char))
    #-(or allegro clisp cmu gcl lispworks)
    (error 'not-implemented :proc (list 'open-socket host port bin))))

(setq $in_netmath t)
(setq $show_openplot nil))

(defun getpid ( &aux tem)

  (cond ((fboundp 'sys::program-id)
                                        ; ;under windows above does not work.
        ((consp (setq tem (errset (system::getenv "PID"))))
         (read-from-string (car tem)))
        (t (format t "using fake value for pid") -1))
(defun getpid () (unix:unix-getpid))

#+(or gcl clisp cmu)
(defun xchdir (w)
  #+clisp (cd w)
  #+gcl (si::chdir w)
  #+cmu (unix::unix-chdir w)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]