]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/unix/kqueue/kqueue.factor
use radix literals
[factor.git] / basis / unix / kqueue / kqueue.factor
index 83c3bb5232c50cdbb76b3c3a61daf30baf670601..c47ee3ecaed7d599987c1439164e65aa182a533f 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax system sequences vocabs.loader words ;
+USING: alien.c-types alien.syntax system sequences vocabs.loader words
+accessors vocabs ;
 IN: unix.kqueue
 
 << "unix.kqueue." os name>> append require >>
@@ -8,47 +9,47 @@ IN: unix.kqueue
 FUNCTION: int kqueue ( ) ;
 
 ! actions
-: EV_ADD     HEX: 1 ; inline ! add event to kq (implies enable)
-: EV_DELETE  HEX: 2 ; inline ! delete event from kq
-: EV_ENABLE  HEX: 4 ; inline ! enable event
-: EV_DISABLE HEX: 8 ; inline ! disable event (not reported)
+CONSTANT: EV_ADD     0x1 ! add event to kq (implies enable)
+CONSTANT: EV_DELETE  0x2 ! delete event from kq
+CONSTANT: EV_ENABLE  0x4 ! enable event
+CONSTANT: EV_DISABLE 0x8 ! disable event (not reported)
 
 ! flags
-: EV_ONESHOT HEX: 10 ; inline ! only report one occurrence
-: EV_CLEAR   HEX: 20 ; inline ! clear event state after reporting
+CONSTANT: EV_ONESHOT 0x10 ! only report one occurrence
+CONSTANT: EV_CLEAR   0x20 ! clear event state after reporting
 
-: EV_SYSFLAGS HEX: f000 ; inline ! reserved by system
-: EV_FLAG0    HEX: 1000 ; inline ! filter-specific flag
-: EV_FLAG1    HEX: 2000 ; inline ! filter-specific flag
+CONSTANT: EV_SYSFLAGS 0xf000 ! reserved by system
+CONSTANT: EV_FLAG0    0x1000 ! filter-specific flag
+CONSTANT: EV_FLAG1    0x2000 ! filter-specific flag
 
 ! returned values
-: EV_EOF          HEX: 8000 ; inline ! EOF detected
-: EV_ERROR        HEX: 4000 ; inline ! error, data contains errno
-
-: EV_POLL EV_FLAG0 ; inline
-: EV_OOBAND EV_FLAG1 ; inline
-
-: NOTE_LOWAT      HEX: 00000001 ; inline ! low water mark
-
-: NOTE_DELETE     HEX: 00000001 ; inline ! vnode was removed
-: NOTE_WRITE      HEX: 00000002 ; inline ! data contents changed
-: NOTE_EXTEND     HEX: 00000004 ; inline ! size increased
-: NOTE_ATTRIB     HEX: 00000008 ; inline ! attributes changed
-: NOTE_LINK       HEX: 00000010 ; inline ! link count changed
-: NOTE_RENAME     HEX: 00000020 ; inline ! vnode was renamed
-: NOTE_REVOKE     HEX: 00000040 ; inline ! vnode access was revoked
-
-: NOTE_EXIT       HEX: 80000000 ; inline ! process exited
-: NOTE_FORK       HEX: 40000000 ; inline ! process forked
-: NOTE_EXEC       HEX: 20000000 ; inline ! process exec'd
-: NOTE_PCTRLMASK  HEX: f0000000 ; inline ! mask for hint bits
-: NOTE_PDATAMASK  HEX: 000fffff ; inline ! mask for pid
-
-: NOTE_SECONDS    HEX: 00000001 ; inline ! data is seconds
-: NOTE_USECONDS   HEX: 00000002 ; inline ! data is microseconds
-: NOTE_NSECONDS   HEX: 00000004 ; inline ! data is nanoseconds
-: NOTE_ABSOLUTE   HEX: 00000008 ; inline ! absolute timeout
-
-: NOTE_TRACK      HEX: 00000001 ; inline ! follow across forks
-: NOTE_TRACKERR   HEX: 00000002 ; inline ! could not track child
-: NOTE_CHILD      HEX: 00000004 ; inline ! am a child process
+CONSTANT: EV_EOF          0x8000 ! EOF detected
+CONSTANT: EV_ERROR        0x4000 ! error, data contains errno
+
+ALIAS: EV_POLL EV_FLAG0
+ALIAS: EV_OOBAND EV_FLAG1
+
+CONSTANT: NOTE_LOWAT      0x00000001 ! low water mark
+
+CONSTANT: NOTE_DELETE     0x00000001 ! vnode was removed
+CONSTANT: NOTE_WRITE      0x00000002 ! data contents changed
+CONSTANT: NOTE_EXTEND     0x00000004 ! size increased
+CONSTANT: NOTE_ATTRIB     0x00000008 ! attributes changed
+CONSTANT: NOTE_LINK       0x00000010 ! link count changed
+CONSTANT: NOTE_RENAME     0x00000020 ! vnode was renamed
+CONSTANT: NOTE_REVOKE     0x00000040 ! vnode access was revoked
+
+CONSTANT: NOTE_EXIT       0x80000000 ! process exited
+CONSTANT: NOTE_FORK       0x40000000 ! process forked
+CONSTANT: NOTE_EXEC       0x20000000 ! process exec'd
+CONSTANT: NOTE_PCTRLMASK  0xf0000000 ! mask for hint bits
+CONSTANT: NOTE_PDATAMASK  0x000fffff ! mask for pid
+
+CONSTANT: NOTE_SECONDS    0x00000001 ! data is seconds
+CONSTANT: NOTE_USECONDS   0x00000002 ! data is microseconds
+CONSTANT: NOTE_NSECONDS   0x00000004 ! data is nanoseconds
+CONSTANT: NOTE_ABSOLUTE   0x00000008 ! absolute timeout
+
+CONSTANT: NOTE_TRACK      0x00000001 ! follow across forks
+CONSTANT: NOTE_TRACKERR   0x00000002 ! could not track child
+CONSTANT: NOTE_CHILD      0x00000004 ! am a child process