On Fri, Feb 09, 2007 at 10:14:38AM +0000, Lars Rune Nøstdal wrote:
>James Bielman <jamesjb <at> gmail.com> writes:
>> 
>> What's the use case for this?  
>
>Short answer: `g_object_new'.
how many possible ways of using g_object_new do you have ?
if not too many perhaps you could so somethig like this:

(defsyscall ("fcntl" %fcntl-without-arg) :int :noexport
  (fd  :int)
  (cmd :int))

(defsyscall ("fcntl" %fcntl-with-int-arg) :int :noexport
  (fd  :int)
  (cmd :int)
  (arg :int))

(defsyscall ("fcntl" %fcntl-with-pointer-arg) :int :noexport
  (fd  :int)
  (cmd :int)
  (arg :pointer))

(define-entry-point fcntl (fd cmd &optional (arg nil argp))
  (cond ((not argp)     (%fcntl-without-arg fd cmd))
        ((integerp arg) (%fcntl-with-int-arg fd cmd arg))
        ((pointerp arg) (%fcntl-with-pointer-arg fd cmd arg))
        (t              (error "Wrong argument to fcntl: ~S" arg))))

(defsyscall is a wrapper around foreign-funcall and define-entry-point
does only a defun+export)

-- 
(sign :name "Stelian Ionescu" :aka "fe[nl]ix"
      :quote "Quidquid latine dictum sit, altum sonatur.")

Attachment: pgpLn7Oh1dbSk.pgp
Description: PGP signature

_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to