Clean up alien.c-types changes a little
parent
c7d22fe439
commit
e139a7a02d
|
@ -18,9 +18,6 @@ SYMBOLS:
|
|||
|
||||
SINGLETON: void
|
||||
|
||||
DEFER: <ref>
|
||||
DEFER: deref
|
||||
|
||||
TUPLE: abstract-c-type
|
||||
{ class class initial: object }
|
||||
{ boxed-class class initial: object }
|
||||
|
@ -108,8 +105,6 @@ M: c-type-name base-type c-type ;
|
|||
|
||||
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>> ;
|
||||
|
@ -474,10 +469,11 @@ M: double-2-rep rep-component-type drop double ;
|
|||
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
|
||||
|
|
|
@ -21,7 +21,7 @@ IN: calendar.unix
|
|||
timespec>duration since-1970 ;
|
||||
|
||||
: get-time ( -- alien )
|
||||
f time <time_t> localtime ;
|
||||
f time time_t <ref> localtime ;
|
||||
|
||||
: timezone-name ( -- string )
|
||||
get-time zone>> ;
|
||||
|
|
|
@ -22,5 +22,3 @@ TYPEDEF: __uint32_t fflags_t
|
|||
TYPEDEF: long ssize_t
|
||||
TYPEDEF: int pid_t
|
||||
TYPEDEF: long time_t
|
||||
|
||||
: <time_t> ( n -- long ) long <ref> ;
|
||||
|
|
|
@ -33,7 +33,3 @@ TYPEDEF: char[512] io_string_t
|
|||
TYPEDEF: kern_return_t IOReturn
|
||||
|
||||
TYPEDEF: uint IOOptionBits
|
||||
|
||||
|
||||
|
||||
: <time_t> ( n -- long ) long <ref> ;
|
||||
|
|
|
@ -17,8 +17,6 @@ TYPEDEF: long ssize_t
|
|||
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 ] }
|
||||
|
|
|
@ -17,5 +17,3 @@ TYPEDEF: __uint32_t fflags_t
|
|||
TYPEDEF: long ssize_t
|
||||
TYPEDEF: int pid_t
|
||||
TYPEDEF: int time_t
|
||||
|
||||
: <time_t> ( n -- time_t ) int <ref> ;
|
||||
|
|
|
@ -32,7 +32,7 @@ TUPLE: x-clipboard atom contents ;
|
|||
|
||||
: 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 )
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
! 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
|
||||
|
@ -79,7 +78,7 @@ CONSTANT: event-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 ;
|
||||
|
|
|
@ -42,7 +42,7 @@ SYMBOL: keysym
|
|||
|
||||
: 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
|
||||
|
|
|
@ -48,12 +48,6 @@ TYPEDEF: int Bool
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue