[cmucl-commit] CMUCL commit: src/code (alieneval.lisp)
Raymond Toy
rtoy at common-lisp.net
Sun Dec 5 16:55:53 CET 2010
Date: Sunday, December 5, 2010 @ 10:55:53
Author: rtoy
Path: /project/cmucl/cvsroot/src/code
Modified: alieneval.lisp
No functional changes. Just update examples.
o Fix typo in callback examples.
o Add package qualifiers so the examples can be used in CL-USER.
----------------+
alieneval.lisp | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
Index: src/code/alieneval.lisp
diff -u src/code/alieneval.lisp:1.69 src/code/alieneval.lisp:1.70
--- src/code/alieneval.lisp:1.69 Tue Apr 20 13:57:43 2010
+++ src/code/alieneval.lisp Sun Dec 5 10:55:53 2010
@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain.
;;;
(ext:file-comment
- "$Header: /project/cmucl/cvsroot/src/code/alieneval.lisp,v 1.69 2010-04-20 17:57:43 rtoy Rel $")
+ "$Header: /project/cmucl/cvsroot/src/code/alieneval.lisp,v 1.70 2010-12-05 15:55:53 rtoy Exp $")
;;;
;;; **********************************************************************
;;;
@@ -2120,25 +2120,26 @@
#||
;;; Example 1:
-(defcallback foo (int (arg1 int) (arg2 int))
+(alien:def-callback foo (c-call:int (arg1 c-call:int) (arg2 c-call:int))
(format t "~&foo: ~S, ~S~%" arg1 arg2)
(+ arg1 arg2))
-(alien-funcall (sap-alien (callback foo) (function int int int))
+(alien:alien-funcall (alien:sap-alien (alien:callback foo)
+ (function c-call:int c-call:int c-call:int))
555 444444)
;;; Example 2:
-(def-alien-routine qsort void
+(alien:def-alien-routine qsort c-call:void
(base (* t))
- (nmemb int)
- (size int)
- (compar (* (function int (* t) (* t)))))
-
-(defcallback my< (int (arg1 (* double))
- (arg2 (* double)))
- (let ((a1 (deref arg1))
- (a2 (deref arg2)))
+ (nmemb c-call:int)
+ (size c-call:int)
+ (compar (* (function c-call:int (* t) (* t)))))
+
+(alien:def-callback my< (c-call:int (arg1 (* c-call:double))
+ (arg2 (* c-call:double)))
+ (let ((a1 (alien:deref arg1))
+ (a2 (alien:deref arg2)))
(cond ((= a1 a2) 0)
((< a1 a2) -1)
(t +1))))
@@ -2149,8 +2150,8 @@
(print a)
(qsort (sys:vector-sap a)
(length a)
- (alien-size double :bytes)
- (callback my<))
+ (alien:alien-size c-call:double :bytes)
+ (alien:callback my<))
(print a))
||#
More information about the cmucl-commit
mailing list