(module x11-xpm mzscheme
(require (lib "foreign.ss")) (unsafe!)
(require "x11.ss")
(define libx11 (ffi-lib "libXpm"))
(define-syntax defx11
(syntax-rules (:)
((_ id : x ...)
(define id
(get-ffi-obj (symbol->string 'id) liballegro (_fun x ...))
(get-ffi-obj (regexp-replaces 'id '((#rx"-" "_"))) libx11 (_fun x ...))
))))
(define-syntax defx11*
(syntax-rules (:)
((_ id : x ...)
(begin
(defx11 id : x ...)
(provide id)))
((_ (id x ...) expr ...)
(begin
(provide id)
(define id (lambda (x ...)
expr ...))))))
(define-cstruct _XpmColorSymbol
((name _string)
(value _pointer)
(pixel Pixel)))
(define-cstruct _XpmExtension
((name _string)
(nlines _uint)
(lines _pointer)))
(define-cstruct _XpmColor
((string _string)
(symbolic _string)
(m-color _pointer)
(g4-color _pointer)
(g-color _pointer)
(c-color _pointer)))
(define-cstruct _XpmImage
((width _uint)
(height _uint)
(cpp _uint)
(ncolors _uint)
(color-table _XpmColor-pointer)
(data _pointer)))
(define-cstruct _XpmInfo
((valuemask _ulong)
(hints-cmt _string)
(colors-cmt _string)
(pixels-cmt _string)
(x-hotspot _uint)
(y-hotsport _uint)
(nextensions _uint)
(extensions _XpmExtension-pointer)))
(define-cstruct _XpmAttributes
((valuemask _ulong)
(visual _Visual-pointer)
(colormap ColorMap)
(depth _uint)
(width _uint)
(height _uint)
(x-hotspot _uint)
(y-hotspot _int)
(cpp _uint)
(pixels _pointer)
(npixels _int)
(colorsymbols _XpmColorSymbol)
(numsymbols _uint)
(rgb-fname _string)
(nextensions _uint)
(extensions _XpmExtension-pointer)
(ncolors _uint)
(colortable _XpmColor-pointer)
(hints-cmt _string)
(colors-cmt _string)
(pixels-cmt _string)
(mask-pixel _uint)
(exact-colors _bool)
(closeness _uint)
(red-closeness _uint)
(green-closeness _uint)
(blue-closeness _uint)
(color-key _int)
(alloc-pixels _pointer)
(nalloc-pixels _int)
(alloc-close-colors _bool)
(bitmap-format _int)
(alloc-color _pointer)
(free-colors _pointer)
(color-closure _pointer)))
(defx11* XpmCreatePixmapFromData : _XDisplay-pointer (root : Window) (data : _pointer)
(result : (_ptr o Pixmap))
(mask : (_ptr o Pixmap))
_pointer -> _int
-> (values result mask))
(defx11* XpmCreateDataFromPixmap : _XDisplay-pointer _pointer _ulong _ulong _XpmAttributes-pointer -> _int)
(defx11* XpmReadFileToPixmap : _XDisplay-pointer _ulong _string (_ptr i _ulong) (_ptr i _ulong) _XpmAttributes-pointer -> _int)
(defx11* XpmWriteFileFromPixmap : _XDisplay-pointer _string _ulong _ulong _XpmAttributes-pointer -> _int)
(defx11* XpmCreateImageFromData : _XDisplay-pointer (_ptr i _string) _pointer _pointer _XpmAttributes-pointer -> _int)
(defx11* XpmCreateDataFromImage : _XDisplay-pointer _pointer _XImage-pointer _XImage-pointer _XpmAttributes-pointer -> _int)
(defx11* XpmReadFileToImage : _XDisplay-pointer _string _pointer _pointer _XpmAttributes-pointer -> _int)
(defx11* XpmWriteFileFromImage : _XDisplay-pointer _string _XImage-pointer _XImage-pointer _XpmAttributes-pointer -> _int)
(defx11* XpmCreateImageFromBuffer : _XDisplay-pointer _string _pointer _pointer _XpmAttributes-pointer -> _int)
(defx11* XpmCreatePixmapFromBuffer : _XDisplay-pointer _ulong _string (_ptr i _ulong) (_ptr i _ulong) _XpmAttributes-pointer -> _int)
(defx11* XpmCreateBufferFromImage : _XDisplay-pointer (_ptr i _string) _XImage-pointer _XImage-pointer _XpmAttributes-pointer -> _int)
(defx11* XpmCreateBufferFromPixmap : _XDisplay-pointer (_ptr i _string) _ulong _ulong _XpmAttributes-pointer -> _int)
(defx11* XpmReadFileToBuffer : _string (_ptr i _string) -> _int)
(defx11* XpmWriteFileFromBuffer : _string _string -> _int)
(defx11* XpmReadFileToData : _string _pointer -> _int)
(defx11* XpmWriteFileFromData : _string (_ptr i _string) -> _int)
(defx11* XpmAttributesSize : -> _int)
(defx11* XpmFreeAttributes : _XpmAttributes-pointer -> _void)
(defx11* XpmFreeExtensions : _XpmExtension-pointer _int -> _void)
(defx11* XpmFreeXpmImage : _XpmImage-pointer -> _void)
(defx11* XpmFreeXpmInfo : _XpmInfo-pointer -> _void)
(defx11* XpmGetErrorString : _int -> _string)
(defx11* XpmLibraryVersion : -> _int)
(defx11* XpmReadFileToXpmImage : _string _XpmImage-pointer _XpmInfo-pointer -> _int)
(defx11* XpmWriteFileFromXpmImage : _string _XpmImage-pointer _XpmInfo-pointer -> _int)
(defx11* XpmCreatePixmapFromXpmImage : _XDisplay-pointer _ulong _XpmImage-pointer (_ptr i _ulong) (_ptr i _ulong) _XpmAttributes-pointer -> _int)
(defx11* XpmCreateImageFromXpmImage : _XDisplay-pointer _XpmImage-pointer _pointer _pointer _XpmAttributes-pointer -> _int)
(defx11* XpmCreateXpmImageFromImage : _XDisplay-pointer _XImage-pointer _XImage-pointer _XpmImage-pointer _XpmAttributes-pointer -> _int)
(defx11* XpmCreateXpmImageFromPixmap : _XDisplay-pointer _ulong _ulong _XpmImage-pointer _XpmAttributes-pointer -> _int)
(defx11* XpmCreateDataFromXpmImage : _pointer _XpmImage-pointer _XpmInfo-pointer -> _int)
(defx11* XpmCreateXpmImageFromData : (_ptr i _string) _XpmImage-pointer _XpmInfo-pointer -> _int)
(defx11* XpmCreateXpmImageFromBuffer : _string _XpmImage-pointer _XpmInfo-pointer -> _int)
(defx11* XpmCreateBufferFromXpmImage : (_ptr i _string) _XpmImage-pointer _XpmInfo-pointer -> _int)
(defx11* XpmFree : (_ptr i _void) -> _void)
)