DalHo Park | 22 Apr 2008 10:45
Picon

a patch for uffi and clsql-oracle unicode problem (sbcl) - continued

Hi,

i'm trying to improve the patch of yesterday.
and found 'uffi:foreign-string-length' function.
but, the function was somewhat misdefined.
defuned with macro body.
so i simply changed defun to defmacro.
and got following error:
The value 235 is not of type CHARACTER.
   [Condition of type TYPE-ERROR]

foreign-string-lengtgh assumes the foreign-string is :unsigned-char array.
i made a simple patch for that. and changed ugly part of my patch for
clsql-oracle(oracle-sql.lisp).

i've only tested on SBCL 1.0.6 on Ubuntu Gutsy.
and these patches override my previous patches.

Regards,

DalHo.
Attachment (strings.patch): text/x-patch, 2467 bytes
Attachment (oracle-sql.patch): text/x-patch, 687 bytes
_______________________________________________
CLSQL mailing list
CLSQL@...
http://lists.b9.com/cgi-bin/mailman/listinfo/clsql
(Continue reading)

DalHo Park | 21 Apr 2008 19:38
Picon

a patch for uffi and clsql-oracle unicode problem (sbcl)

Hi,

first of all, this is related to both uffi and clsql-oracle (so, i
send it to the both).

i had some problems with clsql-oracle with unicode Korean (aka, Hangul).
all the Korean characters were broken (even truncated).

the main problem was 'convert-to-foreign-string' function in
strings.lisp can not convert Korean string correctly.

simple test code (should be tested on unicode capable shell or emacs) :
(defparameter *tests* '("DalHo Park" "박달호"))

(dolist (test *tests*)
  (let* ((f    (uffi:convert-to-foreign-string test))
	 (back (uffi:convert-from-foreign-string f)))
    (format t "~%test=~a, back=~a" test back)
    (assert (string= test back))))

result:
test=DalHo Park, back=DalHo Park
debugger invoked on a SB-INT:C-STRING-DECODING-ERROR in thread
#<THREAD "initial thread" {10025DEED1}>:
  c-string decoding error (:external-format :UTF-8):
    the octet sequence 3 cannot be decoded.

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
(Continue reading)

Nikodemus Siivola | 17 May 2006 15:41
Gravatar

Re: rt from uffi-tests and sbcl from CVS on win32

Yaroslav Kavenchuk <kavenchuk <at> jenty.by> writes:

> This bug of sbcl or uffi?

At a glance this is known SBCL/Win32 issue: lack of support for CRLF
newlines.

Cheers,

  -- Nikodemus              Schemer: "Buddha is small, clean, and serious."
                   Lispnik: "Buddha is big, has hairy armpits, and laughs."

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Thiemo Seufer | 17 May 2006 15:41
Picon

Re: rt from uffi-tests and sbcl from CVS on win32

Yaroslav Kavenchuk wrote:
> example of source (from rt.lisp):
> 
> 	  (format s "~&Test ~: <at> (~S~) failed~
>                    ~%Form: ~S~
>                    ~%Expected value~P: ~
>                       ~{~S~^~%~17t~}~%"
> 		  *test* (form entry)
> 		  (length (vals entry))
> 		  (vals entry))
> 
> result of compilation:
> 
> error in FORMAT: unknown format directive (character: Return)
>   ~&Test ~: <at> (~S~) failed~^M
>                    ~%Form: ~S~^M
>                    ~%Expected value~P: ~^M
>                       ~{~S~^~%~17t~}~%
>                          ^
>    [Condition of type SB-FORMAT:FORMAT-ERROR]
> 
> This bug of sbcl or uffi?

Looks like a bug in your checkout, something inserted ^M at EOL.

Thiemo

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
(Continue reading)

Yaroslav Kavenchuk | 17 May 2006 15:24
Picon

rt from uffi-tests and sbcl from CVS on win32

example of source (from rt.lisp):

	  (format s "~&Test ~: <at> (~S~) failed~
                    ~%Form: ~S~
                    ~%Expected value~P: ~
                       ~{~S~^~%~17t~}~%"
		  *test* (form entry)
		  (length (vals entry))
		  (vals entry))

result of compilation:

error in FORMAT: unknown format directive (character: Return)
   ~&Test ~: <at> (~S~) failed~^M
                    ~%Form: ~S~^M
                    ~%Expected value~P: ~^M
                       ~{~S~^~%~17t~}~%
                          ^
    [Condition of type SB-FORMAT:FORMAT-ERROR]

This bug of sbcl or uffi?

Thanks.

--

-- 
WBR, Yaroslav Kavenchuk.

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
(Continue reading)

Kenny Tilton | 10 Jun 2005 07:27
Picon

UFFI, CLisp, and the GPL

Not sure if I followed the concerns expressed here in re CLisp and the 
GPL, but I raised the issue of FFI not being one of the public packages 
exempt from GPL on the CLisp list. The copyright is being changed, and 
UFFI looks to be in the clear if it is extended to support CLisp. But IANAL.

kenny
james anderson | 7 Jun 2005 14:04

object.lisp / aggregates.lisp dependency

hello;

i observe that, in order to compile uffi without intermediate loads,  
the definition of size-of-foreign-type in objects.lisp needs an eval- 
when wrapper, as a macro-expansion in aggregates.lisp requires it.

...
James Bielman | 4 Jun 2005 13:42

Question about foreign arrays in LispWorks

Hi,

Is this the correct way to allocate (on the stack if possible) a
foreign array of ints and access it?  It seems to work okay in OpenMCL
and SBCL but it bombs with a bus error in LispWorks Personal 4.4 (on
OSX, I don't have other LispWorks platforms handy at the moment):

(defun array-test ()
  (with-foreign-object (a '(:array :int 5))
    (setf (deref-array a '(:array :int) 0) 666)
    (deref-array a '(:array :int) 0)))

James
James Bielman | 4 Jun 2005 13:38

[patch] fix :calling-convention warning in OS X LW FLI

Hi,

The following small patch fixes a warning due to the Mac OS X
Lispworks FLI not supporting :CALLING-CONVENTION when defining foreign
functions:

--- functions.lisp.orig	2005-06-04 02:17:36.000000000 -0700
+++ functions.lisp	2005-06-04 02:17:44.000000000 -0700
 <at>  <at>  -200,7 +200,7  <at>  <at> 
        , <at> (if module (list :module module) (values))
        :result-type ,result-type
       :language :ansi-c
-       :calling-convention :cdecl)
+       #-macosx :calling-convention #-macosx :cdecl)
     #+(and mcl (not openmcl))
     `(eval-when (:compile-toplevel :load-toplevel :execute)
        (ccl:define-entry-point (,lisp-name ,foreign-name)

James
Kevin Rosenberg | 28 Apr 2005 18:37
Favicon

Re: one more uffi thing

Cyrus Harmon wrote:
> def-function has module as a keyword arg and def-foreign-var has it as 
> a required argument. Can/should these two match? I don't use lispworks, 
> so it doesn't seem to matter for me. Just trying to make things 
> consistent.

[cc: uffi-devel list]

Hi Cyrus, 

Consistency is a good thing. Yes, matching module parameters would be
better. The def-foreign-var macro was graciously submitted as a patch
and unfortunately I didn't consider the parameter list closely.

Some number of packages depend upon def-foreign-var. More importantly,
there's know way for me to know just what packages depend upon that
macro. Thus, I don't think a change that breaks current applications
just to improve consistency across functions is warranted.[1]

So, while making module a keyword argument for compatibility, I don't
see it worthwhile to break existing applications. The parameter could
be made optional, but that really defeats the purpose of using
UFFI. People using the application on Lispworks may have difficulty
using the application if the programmer decided not to supply the
optional module parameter.

Kevin

[1] The paradox of maintaining libraries that people actually use --
some improvements are not made due to need not to break applications
(Continue reading)

James Bielman | 1 Apr 2005 03:45

patch: def-foreign-var support for openmcl

Hi,

Here's a patch that adds support for DEF-FOREIGN-VAR on OpenMCL.

The foreign-var tests that use modify macros on foreign structures
still fail because of evaluation problems with UFFI:GET-SLOT-VALUE,
but I think this is still reasonably correct.  It is also more consy
than it could be but not terribly so (16 bytes per access, compared
to 80 or so for SBCL).

This patch also conditionalizes out a second definition of the
WITH-CAST-POINTER macro that shadows the correct definition.

Tested on Darwin OpenMCL 0.14.3, I don't know about LinuxPPC or MCL.

James

--- objects.lisp.orig	2005-03-31 16:10:54.000000000 -0800
+++ objects.lisp	2005-03-31 16:14:03.000000000 -0800
 <at>  <at>  -238,9 +238,9  <at>  <at> 
   `(let ((,binding-name ,pointer))
     , <at> body))

-#-(or lispworks cmu scl sbcl allegro)
+#-(or lispworks cmu scl sbcl allegro openmcl)
 (defmacro with-cast-pointer ((binding-name pointer type) &body body)
-  (declare (ignore binding-name pointer type))
+  (declare (ignore binding-name pointer type body))
   '(error "WITH-CAST-POINTER not (yet) implemented for ~A"
           (lisp-implementation-type)))
(Continue reading)


Gmane