From: Julian Squires Date: Mon, 3 Nov 2008 20:41:15 +0000 (-0500) Subject: Added automatic translation of pathnames via namestring. X-Git-Url: https://repo.or.cz/w/cl-devil.git/commitdiff_plain/afb30d3222b6b975a1f96c0664678bbbc779bc86 Added automatic translation of pathnames via namestring. --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c0ca3e9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.fasl +*~ +*.pfsl diff --git a/il.lisp b/il.lisp index 0884051..5be79ea 100644 --- a/il.lisp +++ b/il.lisp @@ -125,18 +125,26 @@ (:image-origin #x0DFE) (:image-channels #x0DFF)) +(define-foreign-type pathname-string-type () + () + (:actual-type :string) + (:simple-parser pathname-string)) +(eval-when (:compile-toplevel :load-toplevel) + (defmethod expand-to-foreign-dyn (value var body (type pathname-string-type)) + `(with-foreign-string (,var (if (pathnamep ,value) (namestring ,value) ,value)) + ,@body))) (defcfun ("ilInit" init) :void) (defcfun ("ilShutDown" shutdown) :void) (defcfun ("ilGenImages" %gen-images) :void (num :int) (images :pointer)) (defcfun ("ilBindImage" bind-image) :void (image :int)) (defcfun ("ilDeleteImages" delete-images) :void (num :int) (images :pointer)) -(defcfun ("ilLoadImage" load-image) :boolean (file-name :string)) -(defcfun ("ilLoad" load) :boolean (type image-type) (file-name :string)) +(defcfun ("ilLoadImage" load-image) :boolean (file-name pathname-string)) +(defcfun ("ilLoad" load) :boolean (type image-type) (file-name pathname-string)) (defcfun ("ilLoadF" load-f) :boolean (type image-type) (file handle)) (defcfun ("ilLoadL" load-l) :boolean (type image-type) (lump :pointer) (size :uint)) -(defcfun ("ilSaveImage" save-image) :boolean (file-name :string)) -(defcfun ("ilSave" save) :boolean (type image-type) (file-name :string)) +(defcfun ("ilSaveImage" save-image) :boolean (file-name pathname-string)) +(defcfun ("ilSave" save) :boolean (type image-type) (file-name pathname-string)) (defcfun ("ilSaveF" save-f) :boolean (type image-type) (file handle)) (defcfun ("ilSaveL" save-l) :boolean (type image-type) (lump :pointer) (size :uint)) (defcfun ("ilTexImage" tex-image) :boolean