Gregory Vanuxem wrote:
> Le dimanche 24 juin 2007 ? 14:03 +0200, Waldek Hebisch a écrit :
> 
> > Concerning writablep: I looked at your code.  But AFAICS we would
> > need a separate version for each Lisp system.  And the code is
> > actually more complicated than C version.  So I think it is better
> > to call C version.  I still have to work out some details, but
> > for writablep it seem to work.  To say the truth I would like
> > to limit use writablep/readable just to (rare) sitations when
> > one really needs them and eliminate them from other places.
> 
> Even in the algebra code (FileNameCategory) ? If I remember correctly
> you suppressed several check of this type in the algebra. Does that mean
> that you'll remove the readable? and consort functions ?
> 

Yes, at some time we will have to rework FileNameCategory.  But
for both technical reasons (problem with bootstrap) and
nontechnical reasons (I do not want introduce now an incompatible
dialect od Spad) I wait with such change.  

> > Attached you will find a little Lisp file "ffi-tst.lisp" and a
> > patch.  After applying the patch compiling Axiom will build
> > a shared library "libspad.so" in the src subdirectory.  ATM one
> > has to copy it by hand to "target/x86_64-unknown-linux/lib/" directory.
> > Before installing "libspad.so" one has to compile "ffi-tst.lisp"
> > (for Axiom, as it uses "BOOT" package) and copy resulting fasl
> > to "target/x86_64-unknown-linux/lib/".  Once both are installed
> > writablep should work OK.  Also some socket functions will work
> > (but I have to work out "sock_get_string_buf" and fix various
> > portablity problems including console handling before socket
> > code will have any visible effect).
> 
> There is, apparently, no attachment to your mail. I would be glad to
> look at your code.
> 

Sorry I forgot to attach them -- I am sending them with this message.

-- 
                              Waldek Hebisch
[EMAIL PROTECTED] 
(in-package "BOOT")
;;; (use-package "SB-ALIEN")
#+sbcl 
(progn
     (SB-ALIEN::define-alien-routine
           ("writeablep" |writeablep|) SB-ALIEN::int
           (filename SB-ALIEN::c-string))

     (SB-ALIEN::define-alien-routine
           ("open_server" open_server) SB-ALIEN::int
           (server_name SB-ALIEN::c-string))
     (SB-ALIEN::define-alien-routine
          ("sock_get_int" sock_get_int) SB-ALIEN::int
          (purpose SB-ALIEN::int :in))
     (SB-ALIEN::define-alien-routine
          ("sock_send_int" sock_send_int) SB-ALIEN::int
          (purpose SB-ALIEN::int :in)
          (val SB-ALIEN::int :in))
     (SB-ALIEN::define-alien-routine
          ("sock_get_float" sock_get_float) SB-ALIEN::double
          (purpose SB-ALIEN::int :in))
     (SB-ALIEN::define-alien-routine
          ("sock_send_float" sock_send_float) SB-ALIEN::int
          (purpose SB-ALIEN::int :in)
          (num SB-ALIEN::double :in))
#|
     (define-alien-routine
          ("sock_get_string_buf" sock_get_string_buf_wrapper) int
          (purpose int :in)
          (...))
|#          
          
     (SB-ALIEN::define-alien-routine
          ("sock_send_string" sock_send_string) SB-ALIEN::int
          (purpose SB-ALIEN::int :in)
          (str SB-ALIEN::c-string))
     (SB-ALIEN::define-alien-routine
          ("sock_send_string_len" sock_send_string_len) SB-ALIEN::int
          (purpose SB-ALIEN::int :in)
          (str SB-ALIEN::c-string)
          (len SB-ALIEN::int :in))
     (SB-ALIEN::define-alien-routine ("server_switch" server_switch)
          SB-ALIEN::int)
#|
     (define-alien-routine ("sock_send_signal" sock_send_signal) int
          (purpose int :in)
          (sig int :in))
|#

)
diff -ru --exclude=Makefile.in por/wh-20070527/src/interp/bookvol5.pamphlet 
wh-20070527.bb/src/interp/bookvol5.pamphlet
--- por/wh-20070527/src/interp/bookvol5.pamphlet        2007-05-27 
17:01:40.000000000 +0200
+++ wh-20070527.bb/src/interp/bookvol5.pamphlet 2007-06-14 00:05:07.000000000 
+0200
@@ -658,6 +658,18 @@
      (progn 
       (setq $openServerIfTrue nil) 
       (setq |$SpadServer| t)))))
+#+:sbcl
+ (let* ((ax-dir (|getEnv| "AXIOM"))
+        (spad-lib (concatenate 'string ax-dir "/lib/libspad.so"))
+        (sock-fasl (concatenate 'string ax-dir "/lib/ffi-tst.fasl")))
+     (when (axiom-probe-file spad-lib)
+         (sb-alien::load-shared-object spad-lib)
+         (load sock-fasl)
+         (let ((os (|openServer| $SpadServerName)))
+              (if (zerop os)
+                  (progn
+                       (setq $openServerIfTrue nil)
+                       (setq |$SpadServer| t))))))
 ;; We do the following test at runtime to allow us to use the same images
 ;; with Saturn and Sman.  MCD 30-11-95
 #+:CCL
diff -ru --exclude=Makefile.in por/wh-20070527/src/lib/Makefile.pamphlet 
wh-20070527.bb/src/lib/Makefile.pamphlet
--- por/wh-20070527/src/lib/Makefile.pamphlet   2007-05-27 17:01:54.000000000 
+0200
+++ wh-20070527.bb/src/lib/Makefile.pamphlet    2007-06-14 00:05:08.000000000 
+0200
@@ -41,6 +41,7 @@
 
 <<environment>>=
 core_sources = bsdsignal.c cfuns-c.c sockio-c.c
+core_objects = $(core_sources:.c=.$(OBJEXT))
 @
 
 
@@ -116,7 +117,7 @@
 .PRECIOUS: %.$(OBJEXT)
 
 %.$(OBJEXT): %.c $(axiom_c_macros_h)
-       $(CC) $(CCF) -c $(axiom_includes) $(AXIOM_X11_CFLAGS) $< -o $@
+       $(CC) -fPIC $(CCF) -c $(axiom_includes) $(AXIOM_X11_CFLAGS) $< -o $@
 @
 
 
@@ -168,7 +169,7 @@
 all: all-ax
 
 all-ax all-lib: stamp
-stamp: libspad.a $(other_objects)
+stamp: libspad.a libspad.so $(other_objects)
        rm -f stamp
        $(STAMP) stamp
 
@@ -176,6 +177,9 @@
        $(AR) ru libspad.a $(libspad_a_objects)
        $(RANLIB) libspad.a
 
+libspad.so: $(core_objects)
+       $(CC) -shared $(core_objects) -o $@
+
 <<C from pamphlet>>
 
 <<object from C>>
_______________________________________________
Axiom-developer mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-developer

Reply via email to