]> gitweb.factorcode.org Git - factor.git/commitdiff
Clean up alien.c-types changes a little
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 26 Oct 2010 04:09:08 +0000 (21:09 -0700)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 26 Oct 2010 04:09:08 +0000 (21:09 -0700)
basis/alien/c-types/c-types.factor
basis/calendar/unix/unix.factor
basis/unix/types/freebsd/freebsd.factor
basis/unix/types/macosx/macosx.factor
basis/unix/types/netbsd/netbsd.factor
basis/unix/types/openbsd/openbsd.factor
basis/x11/clipboard/clipboard.factor
basis/x11/windows/windows.factor
basis/x11/xim/xim.factor
basis/x11/xlib/xlib.factor

index 6243e37b228f79c0dd41d16db2fdf63e9434c9dc..6821dae15f17b67461380d256948ffbde3055a79 100644 (file)
@@ -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
index 9f7d1659254630d0e2ce08a418b71f1e4d688cb1..58d280248f96d0b921514e3d191444d00ba83f89 100644 (file)
@@ -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>> ;
index a0d7226aac5849aa39eb49ff54d0f59426d63186..41cf7ac18845095c2e170a10f42e554e0e1d00ae 100644 (file)
@@ -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> ;
index 20c84c2e836904b65700855ab5a52880b11f95de..fc435cd9fbf878e42a49c065a550b17230c1ef45 100644 (file)
@@ -33,7 +33,3 @@ TYPEDEF: char[512] io_string_t
 TYPEDEF: kern_return_t IOReturn
 
 TYPEDEF: uint IOOptionBits
-
-
-
-: <time_t> ( n -- long ) long <ref> ;
index 00dd4bcb4a545bfd1424ea6e122331546e07675b..58fd5d400b21ce13ee2dd9ddcaa4e3e600b44821 100644 (file)
@@ -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 ] }
index 071cc4747e23005adf67290dea8b08756cd1025e..30bc539207d6af4ac33778b218a43fddaddcaf3a 100644 (file)
@@ -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> ;
index a711da5580306c54aecae134bfe9939f9b9bfcc5..49a9f8903956f6e521f7e6e1aa20b48d95ee1641 100644 (file)
@@ -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 )
index 1becb30f45f352bee99b62a50b2511729226d3bb..cd1ef0217ff58776a3d7b8042e1c1d1e68202455 100644 (file)
@@ -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 ;
index d47672d59833a9a102c6415b1d6f672c6088f33e..acae3cf89162586e010f7f8c6797f64cfcab2e86 100644 (file)
@@ -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
index 6fc5206711ec645b45a095db3d5220ab5da6baa6..33293746c5aa50164e568480bb45610ca20378ce 100644 (file)
@@ -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