SINGLETON: void
-DEFER: <ref>
-DEFER: deref
-
TUPLE: abstract-c-type
{ class class initial: object }
{ boxed-class class initial: object }
M: c-type base-type ;
-: little-endian? ( -- ? ) 1 int <ref> char deref 1 = ; foldable
-
GENERIC: heap-size ( name -- size )
M: abstract-c-type heap-size size>> ;
dup { float double } member-eq?
[ drop ] [ c-type-interval clamp ] if ; inline
-:: <ref> ( value c-type -- c-ptr )
- c-type heap-size <byte-array> :> c-ptr
- value c-ptr 0 c-type set-alien-value
- c-ptr ; inline
+: <ref> ( value c-type -- c-ptr )
+ [ heap-size <byte-array> ] keep
+ '[ 0 _ set-alien-value ] keep ; inline
: deref ( c-ptr c-type -- value )
[ 0 ] dip alien-value ; inline
+
+: little-endian? ( -- ? ) 1 int <ref> char deref 1 = ; foldable
timespec>duration since-1970 ;
: get-time ( -- alien )
- f time <time_t> localtime ;
+ f time time_t <ref> localtime ;
: timezone-name ( -- string )
get-time zone>> ;
TYPEDEF: long ssize_t
TYPEDEF: int pid_t
TYPEDEF: long time_t
-
-: <time_t> ( n -- long ) long <ref> ;
TYPEDEF: kern_return_t IOReturn
TYPEDEF: uint IOOptionBits
-
-
-
-: <time_t> ( n -- long ) long <ref> ;
TYPEDEF: int pid_t
TYPEDEF: int time_t
-: <time_t> ( n -- time_t ) int <ref> ;
-
cell-bits {
{ 32 [ "unix.types.netbsd.32" require ] }
{ 64 [ "unix.types.netbsd.64" require ] }
TYPEDEF: long ssize_t
TYPEDEF: int pid_t
TYPEDEF: int time_t
-
-: <time_t> ( n -- time_t ) int <ref> ;
: window-property ( win prop delete? -- string )
[ [ dpy get ] 2dip 0 -1 ] dip AnyPropertyType
- 0 <Atom> 0 int <ref> 0 ulong <ref> 0 ulong <ref> f void* <ref>
+ 0 Atom <ref> 0 int <ref> 0 ulong <ref> 0 ulong <ref> f void* <ref>
[ XGetWindowProperty drop ] keep snarf-property ;
: selection-from-event ( event window -- string )
! Copyright (C) 2005, 2010 Eduardo Cavazos, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel math math.bitwise math.vectors
-namespaces sequences arrays fry classes.struct literals
-x11 x11.xlib x11.constants x11.events
-x11.glx ;
+USING: accessors alien.c-types kernel math math.bitwise
+math.vectors namespaces sequences arrays fry classes.struct
+literals x11 x11.xlib x11.constants x11.events x11.glx ;
IN: x11.windows
CONSTANT: create-window-mask
dpy get swap XDestroyWindow drop ;
: set-closable ( win -- )
- dpy get swap XA_WM_DELETE_WINDOW <Atom> 1
+ dpy get swap XA_WM_DELETE_WINDOW Atom <ref> 1
XSetWMProtocols drop ;
: map-window ( win -- ) dpy get swap XMapWindow drop ;
: prepare-lookup ( -- )
buf-size <uint-array> keybuf set
- 0 <KeySym> keysym set ;
+ 0 KeySym <ref> keysym set ;
: finish-lookup ( len -- string keysym )
keybuf get swap 2 * head utf16n decode
TYPEDEF: ulong VisualID
TYPEDEF: ulong Time
-: <XID> ( n -- ulong ) ulong <ref> ;
-ALIAS: <Window> <XID>
-ALIAS: <Drawable> <XID>
-ALIAS: <KeySym> <XID>
-: <Atom> ( n -- ulong ) ulong <ref> ;
-
: *XID ( bytes -- n ) ulong deref ;
ALIAS: *Window *XID
ALIAS: *Drawable *XID