[Openmcl-devel] sharing data between fortran and OpenMCL

Cyrus Harmon ch-openmcl at bobobeach.com
Thu Sep 30 09:49:40 PDT 2004


Ok, this is probably a mistake, but I've been poking around the 
internals of OpenMCL. I'm trying to port matlisp to OpenMCL and have 
run into a couple issues.

I think the core of what I need to do is make the following work under 
OpenMCL:

       (if (typep vec '(simple-array * (*)))
	  (sb-sys:vector-sap vec)
	  (let ((base-address
		 (the (unsigned-byte 32)
		   (logandc1 7 (sb-kernel:get-lisp-obj-address vec)))))
	    (declare (type (unsigned-byte 32) base-address))
	    (sb-sys:int-sap
	     (etypecase vec
	       ((complex double-float)
		(the (unsigned-byte 32) (+ 8 base-address)))
	       ((complex single-float)
		(the (unsigned-byte 32) (+ 4 base-address)))
	       ((simple-array * *)
		;; A multidimensional simple-array
		(let ((data-vector
		       (logandc1 7 (sb-sys:sap-ref-32
				    (sb-sys:int-sap (+ base-address 16))
				    0))))
		  (the (unsigned-byte 32) (+ data-vector 8))))))))))


Obviously, the sb-sys stuff doesn't directly apply. The main issues I 
think I'm facing are figuring out how to get the address of single and 
double complex's and to get access to the data in an array. I think I 
can do this last part with

%vect-data-to-macptr

but I can't figure out how to get access to the single-floats or 
double-floats in a complex. Also, are any of these internal guts 
documented? I've just been poking around in level-0/PPC and 
compiler/PPC trying to find bits that look like they might be useful. 
Any further suggestions?

Thanks,

Cyrus




More information about the Openmcl-devel mailing list