]> gitweb.factorcode.org Git - factor.git/commitdiff
Use flags{ instead of flags all over the place
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 1 Apr 2010 19:43:27 +0000 (14:43 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 1 Apr 2010 19:44:03 +0000 (14:44 -0500)
39 files changed:
basis/core-foundation/file-descriptors/file-descriptors.factor
basis/core-graphics/core-graphics.factor
basis/io/backend/unix/multiplexers/kqueue/kqueue.factor
basis/io/backend/windows/nt/privileges/privileges.factor
basis/io/backend/windows/windows.factor
basis/io/directories/unix/unix.factor
basis/io/files/unique/unix/unix.factor
basis/io/files/unix/unix-tests.factor
basis/io/files/unix/unix.factor
basis/io/files/windows/windows.factor
basis/io/mmap/unix/unix.factor
basis/io/mmap/windows/windows.factor
basis/io/monitors/linux/linux.factor
basis/io/monitors/windows/nt/nt.factor
basis/io/pipes/windows/nt/nt.factor
basis/literals/literals-docs.factor
basis/literals/literals-tests.factor
basis/literals/literals.factor
basis/math/bitwise/bitwise-docs.factor
basis/math/bitwise/bitwise-tests.factor
basis/math/bitwise/bitwise.factor
basis/openssl/libssl/libssl.factor
basis/random/windows/windows.factor
basis/ui/backend/windows/windows.factor
basis/unix/linux/inotify/inotify.factor
basis/unix/statfs/macosx/macosx.factor
basis/windows/directx/d3d9types/d3d9types.factor
basis/windows/errors/errors.factor
basis/windows/gdi32/gdi32.factor
basis/windows/user32/user32.factor
basis/windows/winsock/winsock.factor
basis/x11/windows/windows.factor
basis/x11/xlib/xlib.factor
extra/fullscreen/fullscreen.factor
extra/io/serial/unix/bsd/bsd.factor
extra/io/serial/unix/unix-tests.factor
extra/io/serial/unix/unix.factor
extra/model-viewer/model-viewer.factor
extra/webkit-demo/webkit-demo.factor

index ec5581d4633237cd40d36912344401ae4e90b303..4ec362f0fcec48e7443f9334d5b4e8eb7cef36d7 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax kernel math.bitwise core-foundation ;
+USING: alien.c-types alien.syntax kernel math.bitwise core-foundation
+literals ;
 IN: core-foundation.file-descriptors
 
 TYPEDEF: void* CFFileDescriptorRef
@@ -25,7 +26,7 @@ FUNCTION: void CFFileDescriptorEnableCallBacks (
 ) ;
 
 : enable-all-callbacks ( fd -- )
-    { kCFFileDescriptorReadCallBack kCFFileDescriptorWriteCallBack } flags
+    flags{ kCFFileDescriptorReadCallBack kCFFileDescriptorWriteCallBack }
     CFFileDescriptorEnableCallBacks ;
 
 : <CFFileDescriptor> ( fd callback -- handle )
index f3f759115cc2204ccab25a097ffaf23f35e27f9d..82b8191621922725b62e814a3140ea90b82cfe23 100644 (file)
@@ -3,7 +3,7 @@
 USING: alien alien.c-types alien.destructors alien.syntax accessors
 destructors fry kernel math math.bitwise sequences libc colors
 images images.memory core-graphics.types core-foundation.utilities
-opengl.gl ;
+opengl.gl literals ;
 IN: core-graphics
 
 ! CGImageAlphaInfo
@@ -121,8 +121,7 @@ FUNCTION: uint GetCurrentButtonState ( ) ;
 
 <PRIVATE
 
-: bitmap-flags ( -- flags )
-    { kCGImageAlphaPremultipliedFirst kCGBitmapByteOrder32Host } flags ;
+CONSTANT: bitmap-flags flags{ kCGImageAlphaPremultipliedFirst kCGBitmapByteOrder32Host }
 
 : bitmap-color-space ( -- color-space )
     CGColorSpaceCreateDeviceRGB &CGColorSpaceRelease ;
index 16d0338da532eb39f8e59129797353b2db545155..41fc7a65bca4799a581f88101be5296ec22e3c1d 100644 (file)
@@ -3,7 +3,7 @@
 USING: accessors alien.c-types combinators destructors
 io.backend.unix kernel math.bitwise sequences
 specialized-arrays unix unix.kqueue unix.time assocs
-io.backend.unix.multiplexers classes.struct ;
+io.backend.unix.multiplexers classes.struct literals ;
 SPECIALIZED-ARRAY: kevent
 IN: io.backend.unix.multiplexers.kqueue
 
@@ -31,13 +31,13 @@ M: kqueue-mx dispose* fd>> close-file ;
 
 M: kqueue-mx add-input-callback ( thread fd mx -- )
     [ call-next-method ] [
-        [ EVFILT_READ { EV_ADD EV_ONESHOT } flags make-kevent ] dip
+        [ EVFILT_READ flags{ EV_ADD EV_ONESHOT } make-kevent ] dip
         register-kevent
     ] 2bi ;
 
 M: kqueue-mx add-output-callback ( thread fd mx -- )
     [ call-next-method ] [
-        [ EVFILT_WRITE { EV_ADD EV_ONESHOT } flags make-kevent ] dip
+        [ EVFILT_WRITE flags{ EV_ADD EV_ONESHOT } make-kevent ] dip
         register-kevent
     ] 2bi ;
 
index 6022e91efdcbf4c4e3280c659390d642bc646bee..53a67bbeab4f36fcd503242e08abba5c81a95557 100644 (file)
@@ -2,7 +2,7 @@ USING: alien alien.c-types alien.data alien.syntax arrays continuations
 destructors generic io.mmap io.ports io.backend.windows io.files.windows
 kernel libc locals math math.bitwise namespaces quotations sequences windows
 windows.advapi32 windows.kernel32 windows.types io.backend system accessors
-io.backend.windows.privileges classes.struct windows.errors ;
+io.backend.windows.privileges classes.struct windows.errors literals ;
 IN: io.backend.windows.nt.privileges
 
 TYPEDEF: TOKEN_PRIVILEGES* PTOKEN_PRIVILEGES
@@ -11,7 +11,7 @@ TYPEDEF: TOKEN_PRIVILEGES* PTOKEN_PRIVILEGES
 !  http://msdn.microsoft.com/msdnmag/issues/05/03/TokenPrivileges/
 
 : (open-process-token) ( handle -- handle )
-    { TOKEN_ADJUST_PRIVILEGES TOKEN_QUERY } flags PHANDLE <c-object>
+    flags{ TOKEN_ADJUST_PRIVILEGES TOKEN_QUERY } PHANDLE <c-object>
     [ OpenProcessToken win32-error=0/f ] keep *void* ;
 
 : open-process-token ( -- handle )
index 6ec2ec4dc585968161b98480dee03a2e998def3c..0e0a803679a8bafd7064d6a6ec51900529192c40 100644 (file)
@@ -5,7 +5,7 @@ io.buffers io.files io.ports io.binary io.timeouts system
 strings kernel math namespaces sequences windows.errors
 windows.kernel32 windows.shell32 windows.types splitting
 continuations math.bitwise accessors init sets assocs
-classes.struct classes ;
+classes.struct classes literals ;
 IN: io.backend.windows
 
 TUPLE: win32-handle < disposable handle ;
@@ -43,12 +43,12 @@ HOOK: add-completion io-backend ( port -- )
     <win32-file> |dispose
     dup add-completion ;
 
-: share-mode ( -- n )
-    {
+CONSTANT: share-mode
+    flags{
         FILE_SHARE_READ
         FILE_SHARE_WRITE
         FILE_SHARE_DELETE
-    } flags ; foldable
+    }
 
 : default-security-attributes ( -- obj )
     SECURITY_ATTRIBUTES <struct>
index 77d7f2d1b27354d0be5e328c11f2c16c8c2e20a7..0cc8aaa0e43766f2e508eaebd154e4a33fa61a4e 100644 (file)
@@ -4,11 +4,10 @@ USING: accessors alien.c-types alien.strings combinators
 continuations destructors fry io io.backend io.backend.unix
 io.directories io.encodings.binary io.encodings.utf8 io.files
 io.pathnames io.files.types kernel math.bitwise sequences system
-unix unix.stat vocabs.loader classes.struct unix.ffi ;
+unix unix.stat vocabs.loader classes.struct unix.ffi literals ;
 IN: io.directories.unix
 
-: touch-mode ( -- n )
-    { O_WRONLY O_APPEND O_CREAT O_EXCL } flags ; foldable
+CONSTANT: touch-mode flags{ O_WRONLY O_APPEND O_CREAT O_EXCL }
 
 M: unix touch-file ( path -- )
     normalize-path
index ec72d9128bc4e5a05b6290b6c15afc5ceb08e402..cd60e3d4b8b4c5e0a925baa1251eb412c15b8b06 100644 (file)
@@ -1,11 +1,10 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel io.ports io.backend.unix math.bitwise
-unix system io.files.unique unix.ffi ;
+unix system io.files.unique unix.ffi literals ;
 IN: io.files.unique.unix
 
-: open-unique-flags ( -- flags )
-    { O_RDWR O_CREAT O_EXCL } flags ;
+CONSTANT: open-unique-flags flags{ O_RDWR O_CREAT O_EXCL }
 
 M: unix (touch-unique-file) ( path -- )
     open-unique-flags file-mode open-file close-file ;
index 93e499a5762c53287ea40b9617bd6a97dcb1f27a..06f7473aed44adb91bc35194edb60b4944aad3f5 100644 (file)
@@ -2,7 +2,7 @@ USING: tools.test io.files io.files.temp io.pathnames
 io.directories io.files.info io.files.info.unix continuations
 kernel io.files.unix math.bitwise calendar accessors
 math.functions math unix.users unix.groups arrays sequences
-grouping io.pathnames.private ;
+grouping io.pathnames.private literals ;
 IN: io.files.unix.tests
 
 [ "/usr/libexec/" ] [ "/usr/libexec/awk/" parent-directory ] unit-test
@@ -45,7 +45,7 @@ IN: io.files.unix.tests
 prepare-test-file
 
 [ t ]
-[ test-file { USER-ALL GROUP-ALL OTHER-ALL } flags set-file-permissions perms OCT: 777 = ] unit-test
+[ test-file flags{ USER-ALL GROUP-ALL OTHER-ALL } set-file-permissions perms OCT: 777 = ] unit-test
 
 [ t ] [ test-file user-read? ] unit-test
 [ t ] [ test-file user-write? ] unit-test
@@ -85,7 +85,7 @@ prepare-test-file
 [ f ] [ test-file file-info other-read? ] unit-test
 
 [ t ]
-[ test-file { USER-ALL GROUP-ALL OTHER-EXECUTE } flags set-file-permissions perms OCT: 771 = ] unit-test
+[ test-file flags{ USER-ALL GROUP-ALL OTHER-EXECUTE } set-file-permissions perms OCT: 771 = ] unit-test
 
 prepare-test-file
 
index bf0a21f997921bd32b6256e3ea847571968b5669..e695345125ce8b058d888b3a3af7ea77e55b78de 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: unix byte-arrays kernel io.backend.unix math.bitwise
 io.ports io.files io.files.private io.pathnames environment
-destructors system unix.ffi ;
+destructors system unix.ffi literals ;
 IN: io.files.unix
 
 M: unix cwd ( -- path )
@@ -12,15 +12,14 @@ M: unix cwd ( -- path )
 
 M: unix cd ( path -- ) [ chdir ] unix-system-call drop ;
 
-: read-flags ( -- n ) O_RDONLY ; inline
+CONSTANT: read-flags flags{ O_RDONLY }
 
-: open-read ( path -- fd ) O_RDONLY file-mode open-file ;
+: open-read ( path -- fd ) read-flags file-mode open-file ;
 
 M: unix (file-reader) ( path -- stream )
     open-read <fd> init-fd <input-port> ;
 
-: write-flags ( -- n )
-    { O_WRONLY O_CREAT O_TRUNC } flags ; inline
+CONSTANT: write-flags flags{ O_WRONLY O_CREAT O_TRUNC }
 
 : open-write ( path -- fd )
     write-flags file-mode open-file ;
@@ -28,8 +27,7 @@ M: unix (file-reader) ( path -- stream )
 M: unix (file-writer) ( path -- stream )
     open-write <fd> init-fd <output-port> ;
 
-: append-flags ( -- n )
-    { O_WRONLY O_APPEND O_CREAT } flags ; inline
+CONSTANT: append-flags flags{ O_WRONLY O_APPEND O_CREAT }
 
 : open-append ( path -- fd )
     [
index c4c848cb648ea92ff558d9ec97a6a16da0492c64..4fc2057a744e0c5187d8342f41011479d1ab8fd7 100644 (file)
@@ -6,7 +6,8 @@ io.backend.windows kernel math splitting fry alien.strings
 windows windows.kernel32 windows.time windows.types calendar
 combinators math.functions sequences namespaces make words
 system destructors accessors math.bitwise continuations
-windows.errors arrays byte-arrays generalizations alien.data ;
+windows.errors arrays byte-arrays generalizations alien.data
+literals ;
 IN: io.files.windows
 
 : open-file ( path access-mode create-mode flags -- handle )
@@ -16,7 +17,7 @@ IN: io.files.windows
     ] with-destructors ;
 
 : open-r/w ( path -- win32-file )
-    { GENERIC_READ GENERIC_WRITE } flags
+    flags{ GENERIC_READ GENERIC_WRITE }
     OPEN_EXISTING 0 open-file ;
 
 : open-read ( path -- win32-file )
@@ -29,7 +30,7 @@ IN: io.files.windows
     GENERIC_WRITE OPEN_ALWAYS 0 open-file ;
 
 : open-existing ( path -- win32-file )
-    { GENERIC_READ GENERIC_WRITE } flags
+    flags{ GENERIC_READ GENERIC_WRITE }
     share-mode
     f
     OPEN_EXISTING
@@ -38,7 +39,7 @@ IN: io.files.windows
 
 : maybe-create-file ( path -- win32-file ? )
     #! return true if file was just created
-    { GENERIC_READ GENERIC_WRITE } flags
+    flags{ GENERIC_READ GENERIC_WRITE }
     share-mode
     f
     OPEN_ALWAYS
index f426201b062d96eb9930f3aafe1e4c9bf6dcd675..84378efeb80292c3fd1c43f8fedaf2ed3a81c689 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2007 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors destructors io.backend.unix io.mmap
+USING: accessors destructors io.backend.unix io.mmap literals
 io.mmap.private kernel locals math.bitwise system unix unix.ffi ;
 IN: io.mmap.unix
 
@@ -12,13 +12,13 @@ IN: io.mmap.unix
     ] with-destructors ;
 
 M: unix (mapped-file-r/w)
-    { PROT_READ PROT_WRITE } flags
-    { MAP_FILE MAP_SHARED } flags
+    flags{ PROT_READ PROT_WRITE }
+    flags{ MAP_FILE MAP_SHARED }
     O_RDWR mmap-open ;
 
 M: unix (mapped-file-reader)
-    { PROT_READ } flags
-    { MAP_FILE MAP_SHARED } flags
+    flags{ PROT_READ }
+    flags{ MAP_FILE MAP_SHARED }
     O_RDONLY mmap-open ;
 
 M: unix close-mapped-file ( mmap -- )
index e3e3116b59047f5852b9912f7cecdab773bce76a..b1191082b36d78f22b5f69e25ae0f08ef91c9bf2 100644 (file)
@@ -2,7 +2,7 @@ USING: alien alien.c-types arrays destructors generic io.mmap
 io.ports io.backend.windows io.files.windows io.backend.windows.privileges
 io.mmap.private kernel libc math math.bitwise namespaces quotations sequences
 windows windows.advapi32 windows.kernel32 io.backend system
-accessors locals windows.errors ;
+accessors locals windows.errors literals ;
 IN: io.mmap.windows
 
 : create-file-mapping ( hFile lpAttributes flProtect dwMaximumSizeHigh dwMaximumSizeLow lpName -- HANDLE )
@@ -29,9 +29,9 @@ C: <win32-mapped-file> win32-mapped-file
 
 M: windows (mapped-file-r/w)
     [
-        { GENERIC_WRITE GENERIC_READ } flags
+        flags{ GENERIC_WRITE GENERIC_READ }
         OPEN_ALWAYS
-        { PAGE_READWRITE SEC_COMMIT } flags
+        flags{ PAGE_READWRITE SEC_COMMIT }
         FILE_MAP_ALL_ACCESS mmap-open
         -rot <win32-mapped-file>
     ] with-destructors ;
@@ -40,7 +40,7 @@ M: windows (mapped-file-reader)
     [
         GENERIC_READ
         OPEN_ALWAYS
-        { PAGE_READONLY SEC_COMMIT } flags
+        flags{ PAGE_READONLY SEC_COMMIT }
         FILE_MAP_READ mmap-open
         -rot <win32-mapped-file>
     ] with-destructors ;
index 31442b7f0b09723b274f24e5f5243805f601a834..9b2440aec88edc8bb975d312224b215c0f779141 100644 (file)
@@ -5,7 +5,7 @@ io.files io.pathnames io.buffers io.ports io.timeouts
 io.backend.unix io.encodings.utf8 unix.linux.inotify assocs
 namespaces make threads continuations init math math.bitwise
 sets alien alien.strings alien.c-types vocabs.loader accessors
-system hashtables destructors unix classes.struct ;
+system hashtables destructors unix classes.struct literals ;
 FROM: namespaces => set ;
 IN: io.monitors.linux
 
@@ -65,13 +65,13 @@ M: linux-monitor dispose* ( monitor -- )
     tri ;
 
 : ignore-flags? ( mask -- ? )
-    {
+    flags{
         IN_DELETE_SELF
         IN_MOVE_SELF
         IN_UNMOUNT
         IN_Q_OVERFLOW
         IN_IGNORED
-    } flags bitand 0 > ;
+    } bitand 0 > ;
 
 : parse-action ( mask -- changed )
     [
index 4d061cbb1ad2df8a0c79cad79cf738509998ba4b..e6a055a9d62f998fc78da3606ee0b05bd5e9a26c 100644 (file)
@@ -5,7 +5,7 @@ locals kernel math assocs namespaces make continuations sequences
 hashtables sorting arrays combinators math.bitwise strings
 system accessors threads splitting io.backend io.backend.windows
 io.backend.windows.nt io.files.windows.nt io.monitors io.ports
-io.buffers io.files io.timeouts io.encodings.string
+io.buffers io.files io.timeouts io.encodings.string literals
 io.encodings.utf16n io windows.errors windows.kernel32 windows.types
 io.pathnames classes.struct ;
 IN: io.monitors.windows.nt
@@ -16,7 +16,7 @@ IN: io.monitors.windows.nt
     share-mode
     f
     OPEN_EXISTING
-    { FILE_FLAG_BACKUP_SEMANTICS FILE_FLAG_OVERLAPPED } flags
+    flags{ FILE_FLAG_BACKUP_SEMANTICS FILE_FLAG_OVERLAPPED }
     f
     CreateFile opened-file ;
 
index 7fce8b4de22bcab96332a5205a7cc11922ab10cf..f87a98ab91fd49a0b7b6286c07c7a0aa2acd11ab 100644 (file)
@@ -10,7 +10,7 @@ IN: io.pipes.windows.nt
 ! http://twistedmatrix.com/trac/browser/trunk/twisted/internet/iocpreactor/process.py
 
 : create-named-pipe ( name -- handle )
-    { PIPE_ACCESS_INBOUND FILE_FLAG_OVERLAPPED } flags
+    flags{ PIPE_ACCESS_INBOUND FILE_FLAG_OVERLAPPED }
     PIPE_TYPE_BYTE
     1
     4096
@@ -21,7 +21,7 @@ IN: io.pipes.windows.nt
 
 : open-other-end ( name -- handle )
     GENERIC_WRITE
-    { FILE_SHARE_READ FILE_SHARE_WRITE } flags
+    flags{ FILE_SHARE_READ FILE_SHARE_WRITE }
     default-security-attributes
     OPEN_EXISTING
     FILE_FLAG_OVERLAPPED
index a464d75b22bbe939c29e9d97d439ca6eff59c734..6fcf8a5e07c807970d6b510e9fef5704f0c68384 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008 Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: help.markup help.syntax kernel multiline ;
+USING: help.markup help.syntax kernel multiline sequences ;
 IN: literals
 
 HELP: $
@@ -62,6 +62,19 @@ ${ five six 7 } .
 
 { POSTPONE: $ POSTPONE: $[ POSTPONE: ${ } related-words
 
+HELP: flags{
+{ $values { "values" sequence } }
+{ $description "Constructs a constant flag value from a sequence of integers or words that output integers. The resulting constant is computed at parse-time, which makes this word as efficient as using a literal integer." }
+{ $examples
+    { $example "USING: literals kernel prettyprint ;"
+        "IN: scratchpad"
+        "CONSTANT: x HEX: 1"
+        "flags{ HEX: 20 x BIN: 100 } .h"
+        "25"
+    }
+} ;
+
+
 ARTICLE: "literals" "Interpolating code results into literal values"
 "The " { $vocab-link "literals" } " vocabulary contains words to run code at parse time and insert the results into more complex literal values."
 { $example """
index d7256a64b140f840b8197c2a8594b68035959955..4357198db6e45a68c2372d0a9e7e6612bca764b3 100644 (file)
@@ -1,4 +1,4 @@
-USING: kernel literals math tools.test ;
+USING: accessors kernel literals math tools.test ;
 IN: literals.tests
 
 <<
@@ -27,3 +27,16 @@ CONSTANT: constant-a 3
 : sixty-nine ( -- a b ) 6 9 ;
 
 [ { 6 9 } ] [ ${ sixty-nine } ] unit-test
+
+CONSTANT: a 1
+CONSTANT: b 2
+ALIAS: c b
+ALIAS: d c
+
+CONSTANT: foo flags{ a b d }
+
+[ 3 ] [ foo ] unit-test
+[ 3 ] [ flags{ a b d } ] unit-test
+\ foo def>> must-infer
+
+[ 1 ] [ flags{ 1 } ] unit-test
index 3e541a80ceba02e7945753fa6221ae479214905d..42a7ab9668a68dc2fb5912d28a6c3b4f56f0a83b 100644 (file)
@@ -25,6 +25,7 @@ SYNTAX: $ scan-word expand-literal >vector ;
 SYNTAX: $[ parse-quotation with-datastack >vector ;
 SYNTAX: ${ \ } [ expand-literals ] parse-literal ;
 SYNTAX: flags{
-    "}" [ parse-word ] map-tokens
-    expand-literals
-    0 [ bitor ] reduce suffix! ;
+    \ } [
+        expand-literals
+        0 [ bitor ] reduce
+    ] parse-literal ;
index ee94479b46e21c96f619604334fe5101398b9b99..4024953070565cb0d725c036cd798bb41160da64 100644 (file)
@@ -135,18 +135,6 @@ HELP: clear-bit
     }
 } ;
 
-HELP: flags
-{ $values { "values" sequence } }
-{ $description "Constructs a constant flag value from a sequence of integers or words that output integers. The resulting constant is computed at compile-time, which makes this word as efficient as using a literal integer." }
-{ $examples
-    { $example "USING: math.bitwise kernel prettyprint ;"
-        "IN: scratchpad"
-        "CONSTANT: x HEX: 1"
-        "{ HEX: 20 x BIN: 100 } flags .h"
-        "25"
-    }
-} ;
-
 HELP: symbols>flags
 { $values { "symbols" sequence } { "assoc" assoc } { "flag-bits" integer } }
 { $description "Constructs an integer value by mapping the values in the " { $snippet "symbols" } " sequence to integer values using " { $snippet "assoc" } " and " { $link bitor } "ing the values together." }
@@ -408,7 +396,6 @@ $nl
 }
 "Bitfields:"
 { $subsections
-    flags
     "math-bitfields"
 } ;
 
index a5919d3ec30bedca953e789e698b4ac60a4422e2..93d2d9e882fa62408a66a9d5a364abbd22bea0e3 100644 (file)
@@ -1,6 +1,6 @@
 USING: accessors math math.bitwise tools.test kernel words
 specialized-arrays alien.c-types math.vectors.simd
-sequences destructors libc ;
+sequences destructors libc literals ;
 SPECIALIZED-ARRAY: int
 IN: math.bitwise.tests
 
@@ -23,17 +23,6 @@ IN: math.bitwise.tests
 : test-1+ ( x -- y ) 1 + ;
 [ 512 ] [ 1 { { test-1+ 8 } } bitfield ] unit-test
 
-CONSTANT: a 1
-CONSTANT: b 2
-
-: foo ( -- flags ) { a b } flags ;
-
-[ 3 ] [ foo ] unit-test
-[ 3 ] [ { a b } flags ] unit-test
-\ foo def>> must-infer
-
-[ 1 ] [ { 1 } flags ] unit-test
-
 [ 8 ] [ 0 3 toggle-bit ] unit-test
 [ 0 ] [ 8 3 toggle-bit ] unit-test
 
index 15db425137a7bedfa2d0949555ec53d60f1c91ed..cd38c8513c9a0ebefe8159e1f75f72793dbbb407 100644 (file)
@@ -44,10 +44,6 @@ IN: math.bitwise
 : W- ( x y -- z ) - 64 bits ; inline
 : W* ( x y -- z ) * 64 bits ; inline
 
-! flags
-MACRO: flags ( values -- )
-    [ 0 ] [ [ ?execute bitor ] curry compose ] reduce ;
-
 : symbols>flags ( symbols assoc -- flag-bits )
     [ at ] curry map
     0 [ bitor ] reduce ;
index bfd59cde250ebff57ead1275ff87e71a076c2f90..96d235d271fc5c98f8842f900b72a98067747e45 100644 (file)
@@ -3,7 +3,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien alien.c-types alien.syntax combinators kernel
 system namespaces assocs parser lexer sequences words
-quotations math.bitwise alien.libraries ;
+quotations math.bitwise alien.libraries literals ;
 
 IN: openssl.libssl
 
@@ -258,15 +258,14 @@ CONSTANT: SSL_SESS_CACHE_OFF    HEX: 0000
 CONSTANT: SSL_SESS_CACHE_CLIENT HEX: 0001
 CONSTANT: SSL_SESS_CACHE_SERVER HEX: 0002
 
-: SSL_SESS_CACHE_BOTH ( -- n )
-    { SSL_SESS_CACHE_CLIENT SSL_SESS_CACHE_SERVER } flags ; inline
+CONSTANT: SSL_SESS_CACHE_BOTH flags{ SSL_SESS_CACHE_CLIENT SSL_SESS_CACHE_SERVER }
 
 CONSTANT: SSL_SESS_CACHE_NO_AUTO_CLEAR      HEX: 0080
 CONSTANT: SSL_SESS_CACHE_NO_INTERNAL_LOOKUP HEX: 0100
 CONSTANT: SSL_SESS_CACHE_NO_INTERNAL_STORE  HEX: 0200
 
-: SSL_SESS_CACHE_NO_INTERNAL ( -- n )
-    { SSL_SESS_CACHE_NO_INTERNAL_LOOKUP SSL_SESS_CACHE_NO_INTERNAL_STORE } flags ; inline
+CONSTANT: SSL_SESS_CACHE_NO_INTERNAL
+    flags{ SSL_SESS_CACHE_NO_INTERNAL_LOOKUP SSL_SESS_CACHE_NO_INTERNAL_STORE }
 
 ! ===============================================
 ! x509_vfy.h
index 30b169bfedc1ac841f67f138a53b70362d91b5c7..72b908a32fcfefd3b3bed953080d18418ffb539e 100644 (file)
@@ -36,7 +36,7 @@ CONSTANT: factor-crypto-container "FactorCryptoContainer"
     ] if ;
 
 : create-crypto-context ( provider type -- handle )
-    { CRYPT_MACHINE_KEYSET CRYPT_NEWKEYSET } flags
+    flags{ CRYPT_MACHINE_KEYSET CRYPT_NEWKEYSET }
     (acquire-crypto-context) win32-error=0/f *void* ;
 
 ERROR: acquire-crypto-context-failed provider type ;
index 8a4ae9853f28f618f0a9d838e6a4e8fa4cccadc8..c0829e5c8dada706571cf4c3e319899aedfcc526 100644 (file)
@@ -628,7 +628,7 @@ M: windows-ui-backend do-events
     WNDCLASSEX <struct> f GetModuleHandle
     class-name-ptr pick GetClassInfoEx 0 = [
         WNDCLASSEX heap-size >>cbSize
-        { CS_HREDRAW CS_VREDRAW CS_OWNDC } flags >>style
+        flags{ CS_HREDRAW CS_VREDRAW CS_OWNDC } >>style
         ui-wndproc >>lpfnWndProc
         0 >>cbClsExtra
         0 >>cbWndExtra
@@ -811,8 +811,7 @@ M: windows-ui-backend (ungrab-input) ( handle -- )
     f ClipCursor drop
     1 ShowCursor drop ;
 
-: fullscreen-flags ( -- n )
-    { WS_CAPTION WS_BORDER WS_THICKFRAME } flags ; inline
+CONSTANT: fullscreen-flags { WS_CAPTION WS_BORDER WS_THICKFRAME }
 
 : enter-fullscreen ( world -- )
     handle>> hWnd>>
@@ -838,7 +837,7 @@ M: windows-ui-backend (ungrab-input) ( handle -- )
         [
             f
             over hwnd>RECT get-RECT-dimensions
-            { SWP_NOMOVE SWP_NOSIZE SWP_NOZORDER SWP_FRAMECHANGED } flags
+            flags{ SWP_NOMOVE SWP_NOSIZE SWP_NOZORDER SWP_FRAMECHANGED }
             SetWindowPos win32-error=0/f
         ]
         [ SW_RESTORE ShowWindow win32-error=0/f ]
index c296cc81661f9c0c5bae2eff13612c6097f80463..947191e7dd458e65597226d25dd694a5b15f8e9c 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2008 Slava Pestov.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
-USING: alien.c-types alien.syntax math math.bitwise classes.struct ;\r
+USING: alien.c-types alien.syntax math math.bitwise classes.struct\r
+literals ;\r
 IN: unix.linux.inotify\r
 \r
 STRUCT: inotify-event\r
@@ -27,8 +28,8 @@ CONSTANT: IN_UNMOUNT HEX: 2000     ! Backing fs was unmounted
 CONSTANT: IN_Q_OVERFLOW HEX: 4000  ! Event queued overflowed\r
 CONSTANT: IN_IGNORED HEX: 8000     ! File was ignored\r
 \r
-: IN_CLOSE ( -- n ) { IN_CLOSE_WRITE IN_CLOSE_NOWRITE } flags ; foldable ! close\r
-: IN_MOVE ( -- n ) { IN_MOVED_FROM IN_MOVED_TO } flags        ; foldable ! moves\r
+CONSTANT: IN_CLOSE flags{ IN_CLOSE_WRITE IN_CLOSE_NOWRITE }\r
+CONSTANT: IN_MOVE flags{ IN_MOVED_FROM IN_MOVED_TO }\r
 \r
 CONSTANT: IN_ONLYDIR HEX: 1000000     ! only watch the path if it is a directory\r
 CONSTANT: IN_DONT_FOLLOW HEX: 2000000 ! don't follow a sym link\r
@@ -36,20 +37,20 @@ CONSTANT: IN_MASK_ADD HEX: 20000000   ! add to the mask of an already existing w
 CONSTANT: IN_ISDIR HEX: 40000000      ! event occurred against dir\r
 CONSTANT: IN_ONESHOT HEX: 80000000    ! only send event once\r
 \r
-: IN_CHANGE_EVENTS ( -- n )\r
-    {\r
+CONSTANT: IN_CHANGE_EVENTS \r
+    flags{\r
         IN_MODIFY IN_ATTRIB IN_MOVED_FROM\r
         IN_MOVED_TO IN_DELETE IN_CREATE IN_DELETE_SELF\r
         IN_MOVE_SELF\r
-    } flags ; foldable\r
+    }\r
 \r
-: IN_ALL_EVENTS ( -- n )\r
-    {\r
+CONSTANT: IN_ALL_EVENTS\r
+    flags{\r
         IN_ACCESS IN_MODIFY IN_ATTRIB IN_CLOSE_WRITE\r
         IN_CLOSE_NOWRITE IN_OPEN IN_MOVED_FROM\r
         IN_MOVED_TO IN_DELETE IN_CREATE IN_DELETE_SELF\r
         IN_MOVE_SELF\r
-    } flags ; foldable\r
+    }\r
 \r
 FUNCTION: int inotify_init ( ) ;\r
 FUNCTION: int inotify_add_watch ( int fd, c-string name, uint mask  ) ;\r
index 75b231da967d4b62e01f13fb524e639ed5db9c65..b5ae2c222327d78541ed9b9a9ab312403d017c05 100644 (file)
@@ -3,7 +3,7 @@
 USING: alien.c-types io.encodings.utf8 io.encodings.string
 kernel sequences unix.stat accessors unix combinators math
 grouping system alien.strings math.bitwise alien.syntax
-unix.types classes.struct unix.ffi ;
+unix.types classes.struct unix.ffi literals ;
 IN: unix.statfs.macosx
 
 CONSTANT: MNT_RDONLY  HEX: 00000001
@@ -29,8 +29,8 @@ CONSTANT: MNT_MULTILABEL  HEX: 04000000
 CONSTANT: MNT_NOATIME HEX: 10000000
 ALIAS: MNT_UNKNOWNPERMISSIONS MNT_IGNORE_OWNERSHIP
 
-: MNT_VISFLAGMASK ( -- n )
-    {
+CONSTANT: MNT_VISFLAGMASK
+    flags{
         MNT_RDONLY MNT_SYNCHRONOUS MNT_NOEXEC
         MNT_NOSUID MNT_NODEV MNT_UNION
         MNT_ASYNC MNT_EXPORTED MNT_QUARANTINE
@@ -38,14 +38,13 @@ ALIAS: MNT_UNKNOWNPERMISSIONS MNT_IGNORE_OWNERSHIP
         MNT_ROOTFS MNT_DOVOLFS MNT_DONTBROWSE
         MNT_IGNORE_OWNERSHIP MNT_AUTOMOUNTED MNT_JOURNALED
         MNT_NOUSERXATTR MNT_DEFWRITE MNT_MULTILABEL MNT_NOATIME
-    } flags ; inline
+    }
 
 CONSTANT: MNT_UPDATE  HEX: 00010000
 CONSTANT: MNT_RELOAD  HEX: 00040000
 CONSTANT: MNT_FORCE   HEX: 00080000
 
-: MNT_CMDFLAGS ( -- n )
-    { MNT_UPDATE MNT_RELOAD MNT_FORCE } flags ; inline
+CONSTANT: MNT_CMDFLAGS flags{ MNT_UPDATE MNT_RELOAD MNT_FORCE }
 
 CONSTANT: VFS_GENERIC 0
 CONSTANT: VFS_NUMMNTOPS 1
index dc0284955309d6279cb592a2db8ff06b6cea61be..618d3c79e541d68e7c9b721575dad604ed995e6e 100644 (file)
@@ -1,5 +1,5 @@
 USING: alien.syntax windows.types classes.struct math alien.c-types
-math.bitwise kernel locals windows.kernel32 ;
+math.bitwise kernel locals windows.kernel32 literals ;
 IN: windows.directx.d3d9types
 
 TYPEDEF: DWORD D3DCOLOR
@@ -54,19 +54,21 @@ CONSTANT: D3DCS_PLANE3      HEX: 00000200
 CONSTANT: D3DCS_PLANE4      HEX: 00000400
 CONSTANT: D3DCS_PLANE5      HEX: 00000800
 
-: D3DCS_ALL ( -- n )
-    { D3DCS_LEFT
-      D3DCS_RIGHT
-      D3DCS_TOP
-      D3DCS_BOTTOM
-      D3DCS_FRONT
-      D3DCS_BACK
-      D3DCS_PLANE0
-      D3DCS_PLANE1
-      D3DCS_PLANE2
-      D3DCS_PLANE3
-      D3DCS_PLANE4
-      D3DCS_PLANE5 } flags ; inline
+CONSTANT: D3DCS_ALL
+    flags{
+        D3DCS_LEFT
+        D3DCS_RIGHT
+        D3DCS_TOP
+        D3DCS_BOTTOM
+        D3DCS_FRONT
+        D3DCS_BACK
+        D3DCS_PLANE0
+        D3DCS_PLANE1
+        D3DCS_PLANE2
+        D3DCS_PLANE3
+        D3DCS_PLANE4
+        D3DCS_PLANE5
+    }
 
 STRUCT: D3DCLIPSTATUS9
     { ClipUnion        DWORD }
@@ -777,8 +779,7 @@ CONSTANT: D3DVS_SWIZZLE_MASK      HEX: 00FF0000
 : D3DVS_W_Z ( -- n ) 2 D3DVS_SWIZZLE_SHIFT 6 + shift ; inline
 : D3DVS_W_W ( -- n ) 3 D3DVS_SWIZZLE_SHIFT 6 + shift ; inline
 
-: D3DVS_NOSWIZZLE ( -- n )
-    { D3DVS_X_X D3DVS_Y_Y D3DVS_Z_Z D3DVS_W_W } flags ; inline
+CONSTANT: D3DVS_NOSWIZZLE flags{ D3DVS_X_X D3DVS_Y_Y D3DVS_Z_Z D3DVS_W_W }
 
 CONSTANT: D3DSP_SWIZZLE_SHIFT     16
 CONSTANT: D3DSP_SWIZZLE_MASK      HEX: 00FF0000
index 67757d05d2df03318dcd0cda8892f282c21b551e..a22b6ec007ca978e913746501aee17b371039c90 100755 (executable)
@@ -1,7 +1,7 @@
 USING: alien.data kernel locals math math.bitwise
 windows.kernel32 sequences byte-arrays unicode.categories
 io.encodings.string io.encodings.utf16n alien.strings
-arrays literals windows.types specialized-arrays ;
+arrays literals windows.types specialized-arrays literals ;
 SPECIALIZED-ARRAY: TCHAR
 IN: windows.errors
 
@@ -705,10 +705,10 @@ CONSTANT: FORMAT_MESSAGE_MAX_WIDTH_MASK   HEX: 000000FF
 
 ERROR: error-message-failed id ;
 :: n>win32-error-string ( id -- string )
-    {
+    flags{
         FORMAT_MESSAGE_FROM_SYSTEM
         FORMAT_MESSAGE_ARGUMENT_ARRAY
-    } flags
+    }
     f
     id
     LANG_NEUTRAL SUBLANG_DEFAULT make-lang-id
index 43307cb6bac99561b4cb939761724fe07fc516d5..93784ea3708aaab2ab7c9e646c4031e10d65c12e 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2005, 2006 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien alien.c-types alien.syntax alien.destructors
-kernel windows.types math.bitwise ;
+kernel windows.types math.bitwise literals ;
 IN: windows.gdi32
 
 CONSTANT: BI_RGB 0
@@ -818,7 +818,7 @@ CONSTANT: TA_RIGHT 2
 CONSTANT: TA_RTLREADING 256
 CONSTANT: TA_NOUPDATECP 0
 CONSTANT: TA_UPDATECP 1
-: TA_MASK ( -- n ) { TA_BASELINE TA_CENTER TA_UPDATECP TA_RTLREADING } flags ; foldable
+CONSTANT: TA_MASK flags{ TA_BASELINE TA_CENTER TA_UPDATECP TA_RTLREADING }
 CONSTANT: VTA_BASELINE 24
 CONSTANT: VTA_CENTER 6
 ALIAS: VTA_LEFT TA_BOTTOM
index 1c23c360712f5ff9e965dfe5a0ee26462e63bda9..54d31bb12b97927113760aa9e41c8a0e9ab2c6f1 100644 (file)
@@ -33,18 +33,17 @@ CONSTANT: WS_MINIMIZEBOX      HEX: 00020000
 CONSTANT: WS_MAXIMIZEBOX      HEX: 00010000
 
 ! Common window styles
-: WS_OVERLAPPEDWINDOW ( -- n )
-    {
+CONSTANT: WS_OVERLAPPEDWINDOW
+    flags{
         WS_OVERLAPPED
         WS_CAPTION
         WS_SYSMENU
         WS_THICKFRAME
         WS_MINIMIZEBOX
         WS_MAXIMIZEBOX
-    } flags ; foldable
+    }
 
-: WS_POPUPWINDOW ( -- n )
-    { WS_POPUP WS_BORDER WS_SYSMENU } flags ; foldable
+CONSTANT: WS_POPUPWINDOW flags{ WS_POPUP WS_BORDER WS_SYSMENU }
 
 ALIAS: WS_CHILDWINDOW      WS_CHILD
 
@@ -76,11 +75,11 @@ CONSTANT: WS_EX_CONTROLPARENT     HEX: 00010000
 CONSTANT: WS_EX_STATICEDGE        HEX: 00020000
 CONSTANT: WS_EX_APPWINDOW         HEX: 00040000
 
-: WS_EX_OVERLAPPEDWINDOW ( -- n )
-    WS_EX_WINDOWEDGE WS_EX_CLIENTEDGE bitor ; foldable
+CONSTANT: WS_EX_OVERLAPPEDWINDOW
+    flags{ WS_EX_WINDOWEDGE WS_EX_CLIENTEDGE }
 
-: WS_EX_PALETTEWINDOW ( -- n )
-    { WS_EX_WINDOWEDGE WS_EX_TOOLWINDOW WS_EX_TOPMOST } flags ; foldable
+CONSTANT: WS_EX_PALETTEWINDOW 
+    flags{ WS_EX_WINDOWEDGE WS_EX_TOOLWINDOW WS_EX_TOPMOST }
 
 CONSTANT: CS_VREDRAW          HEX: 0001
 CONSTANT: CS_HREDRAW          HEX: 0002
index b58cbcacbd0e944fb4188e6c42029b81d4175647..49a3d6e9faf861ce2fb98d31c6f905502b47a365 100644 (file)
@@ -3,7 +3,7 @@
 USING: alien alien.c-types alien.strings alien.syntax arrays
 byte-arrays kernel literals math sequences windows.types
 windows.kernel32 windows.errors math.bitwise io.encodings.utf16n
-classes.struct windows.com.syntax init ;
+classes.struct windows.com.syntax init literals ;
 FROM: alien.c-types => short ;
 IN: windows.winsock
 
@@ -73,8 +73,7 @@ CONSTANT: AI_PASSIVE     1
 CONSTANT: AI_CANONNAME   2
 CONSTANT: AI_NUMERICHOST 4
 
-: AI_MASK ( -- n )
-    { AI_PASSIVE AI_CANONNAME AI_NUMERICHOST } flags ; inline
+CONSTANT: AI_MASK flags{ AI_PASSIVE AI_CANONNAME AI_NUMERICHOST }
 
 CONSTANT: NI_NUMERICHOST 1
 CONSTANT: NI_NUMERICSERV 2
index ad0a8b11a67e06aef97f7add0082c4b8864056b4..7b7ae8b106754f146e2f6152f3457ab4d58f3ead 100644 (file)
@@ -5,15 +5,15 @@ namespaces sequences x11 x11.xlib x11.constants x11.glx arrays
 fry classes.struct ;
 IN: x11.windows
 
-: create-window-mask ( -- n )
-    { CWBackPixel CWBorderPixel CWColormap CWEventMask } flags ;
+CONSTANT: create-window-mask
+    flags{ CWBackPixel CWBorderPixel CWColormap CWEventMask }
 
 : create-colormap ( visinfo -- colormap )
     [ dpy get root get ] dip visual>> AllocNone
     XCreateColormap ;
 
-: event-mask ( -- n )
-    {
+CONSTANT: event-mask
+    flags{
         ExposureMask
         StructureNotifyMask
         KeyPressMask
@@ -25,7 +25,7 @@ IN: x11.windows
         EnterWindowMask
         LeaveWindowMask
         PropertyChangeMask
-    } flags ;
+    }
 
 : window-attributes ( visinfo -- attributes )
     XSetWindowAttributes <struct>
index 1c5ff2e3ef1571af3251c2d1ed8b7d3160e20adf..ac9e5591dc30544d2e9bbdf3287bc1c920ec8f1d 100644 (file)
@@ -12,7 +12,8 @@
 ! and note the section.
 USING: accessors kernel arrays alien alien.c-types alien.data
 alien.strings alien.syntax classes.struct math math.bitwise words
-sequences namespaces continuations io io.encodings.ascii x11.syntax ;
+sequences namespaces continuations io io.encodings.ascii x11.syntax
+literals ;
 FROM: alien.c-types => short ;
 IN: x11.xlib
 
@@ -1134,8 +1135,8 @@ X-FUNCTION: Status XWithdrawWindow (
 : PAspect      ( -- n ) 7 2^ ; inline
 : PBaseSize    ( -- n ) 8 2^ ; inline
 : PWinGravity  ( -- n ) 9 2^ ; inline
-: PAllHints    ( -- n )
-    { PPosition PSize PMinSize PMaxSize PResizeInc PAspect } flags ; foldable
+CONSTANT: PAllHints
+    flags{ PPosition PSize PMinSize PMaxSize PResizeInc PAspect }
 
 STRUCT: XSizeHints
     { flags long }
index a233d6f4f545dfd416e743985c766db888948b2c..458ef3d51e2de1df1ae41dd20543cdec247cde24 100755 (executable)
@@ -16,7 +16,7 @@ IN: fullscreen
 :: (monitor-info>devmodes) ( monitor-info n -- )
     DEVMODE <struct>
         DEVMODE heap-size >>dmSize
-        { DM_BITSPERPEL DM_PELSWIDTH DM_PELSHEIGHT } flags >>dmFields
+        flags{ DM_BITSPERPEL DM_PELSWIDTH DM_PELSHEIGHT } >>dmFields
     :> devmode
 
     monitor-info szDevice>>
@@ -73,11 +73,11 @@ ERROR: display-change-error n ;
 
 : set-fullscreen-styles ( hwnd -- )
     [ GWL_STYLE [ WS_OVERLAPPEDWINDOW unmask ] change-style ]
-    [ GWL_EXSTYLE [ { WS_EX_APPWINDOW WS_EX_TOPMOST } flags bitor ] change-style ] bi ;
+    [ GWL_EXSTYLE [ flags{ WS_EX_APPWINDOW WS_EX_TOPMOST } bitor ] change-style ] bi ;
 
 : set-non-fullscreen-styles ( hwnd -- )
     [ GWL_STYLE [ WS_OVERLAPPEDWINDOW bitor ] change-style ]
-    [ GWL_EXSTYLE [ { WS_EX_APPWINDOW WS_EX_TOPMOST } flags unmask ] change-style ] bi ;
+    [ GWL_EXSTYLE [ flags{ WS_EX_APPWINDOW WS_EX_TOPMOST } unmask ] change-style ] bi ;
 
 ERROR: unsupported-resolution triple ;
 
@@ -92,10 +92,10 @@ ERROR: unsupported-resolution triple ;
     hwnd f
     desktop-monitor-info rcMonitor>> slots{ left top } first2
     triple first2
-    {
+    flags{
         SWP_NOACTIVATE SWP_NOCOPYBITS SWP_NOOWNERZORDER
         SWP_NOREPOSITION SWP_NOZORDER
-    } flags
+    }
     SetWindowPos win32-error=0/f ;
 
 :: enable-fullscreen ( triple hwnd -- rect )
index dbb013aca04ff7a8d3ed859d3738384286093cb0..14d4f515ae94f18d37cecf526f8f6e23e2ab825e 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax kernel math.bitwise sequences system io.serial ;
+USING: alien.syntax kernel math.bitwise sequences system io.serial
+literals ;
 IN: io.serial.unix
 
 M: bsd lookup-baud ( m -- n )
@@ -60,7 +61,7 @@ CONSTANT: HUPCL       HEX: 00004000
 CONSTANT: CLOCAL      HEX: 00008000
 CONSTANT: CCTS_OFLOW  HEX: 00010000
 CONSTANT: CRTS_IFLOW  HEX: 00020000
-: CRTSCTS ( -- n )  { CCTS_OFLOW CRTS_IFLOW } flags ; inline
+CONSTANT: CRTSCTS flags{ CCTS_OFLOW CRTS_IFLOW }
 CONSTANT: CDTR_IFLOW  HEX: 00040000
 CONSTANT: CDSR_OFLOW  HEX: 00080000
 CONSTANT: CCAR_OFLOW  HEX: 00100000
index f4c0c6b45a4cbc91ce9862867c11dc20291c4b2b..422844ab82f1e91222cc785c88b91c0874bd1591 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel math.bitwise io.serial io.serial.unix ;
+USING: accessors kernel math.bitwise io.serial io.serial.unix
+literals ;
 IN: io.serial.unix
 
 : serial-obj ( -- obj )
@@ -10,10 +11,10 @@ IN: io.serial.unix
     ! "/dev/ttyd0" >>path ! freebsd
     ! "/dev/ttyU0" >>path ! openbsd
     19200 >>baud
-    { IGNPAR ICRNL } flags >>iflag
-    { } flags >>oflag
-    { CS8 CLOCAL CREAD } flags >>cflag
-    { ICANON } flags >>lflag ;
+    flags{ IGNPAR ICRNL } >>iflag
+    flags{ } >>oflag
+    flags{ CS8 CLOCAL CREAD } >>cflag
+    flags{ ICANON } >>lflag ;
 
 : serial-test ( -- serial )
     serial-obj
index 6c0de55ec84628b3983e3206f54bce23fdc504d3..fc613da4238164f6451c39c6488dfc7333459a0b 100644 (file)
@@ -3,7 +3,8 @@
 USING: accessors alien.c-types alien.syntax alien.data 
 classes.struct combinators io.ports io.streams.duplex
 system kernel math math.bitwise vocabs.loader io.serial
-io.serial.unix.termios io.backend.unix unix unix.ffi ;
+io.serial.unix.termios io.backend.unix unix unix.ffi
+literals ;
 IN: io.serial.unix
 
 << {
@@ -33,7 +34,7 @@ FUNCTION: int cfsetspeed ( termios* t, speed_t s ) ;
 
 M: unix open-serial ( serial -- serial' )
     dup
-    path>> { O_RDWR O_NOCTTY O_NDELAY } flags file-mode open-file
+    path>> flags{ O_RDWR O_NOCTTY O_NDELAY } file-mode open-file
     fd>duplex-stream >>stream ;
 
 : serial-fd ( serial -- fd )
index 061ce07d1e515d5f5a482f40c08d4d2097234e8f..f1b184f2201423d6adb77cad6b7a09c7f481f83f 100644 (file)
@@ -11,7 +11,7 @@ ui.gadgets.worlds ui.pixel-formats specialized-arrays
 specialized-vectors literals fry
 sequences.deep destructors math.bitwise opengl.gl
 game.models game.models.obj game.models.loader game.models.collada
-prettyprint images.tga ;
+prettyprint images.tga literals ;
 FROM: alien.c-types => float ;
 SPECIALIZED-ARRAY: float
 SPECIALIZED-VECTOR: uint
@@ -164,9 +164,9 @@ TUPLE: vbo
     0 0 0 0 glClearColor 
     1 glClearDepth
     HEX: ffffffff glClearStencil
-    { GL_COLOR_BUFFER_BIT
+    flags{ GL_COLOR_BUFFER_BIT
       GL_DEPTH_BUFFER_BIT
-      GL_STENCIL_BUFFER_BIT } flags glClear ;
+      GL_STENCIL_BUFFER_BIT } glClear ;
     
 : draw-model ( world -- )
     clear-screen
index e6178a55c3604589045f2cc24a2415c2599b44ba..eb24d035dc92b8276953784f49d6a5ba4f6916d4 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: cocoa cocoa.application cocoa.types cocoa.classes cocoa.windows
-core-graphics.types kernel math.bitwise ;
+core-graphics.types kernel math.bitwise literals ;
 IN: webkit-demo
 
 FRAMEWORK: /System/Library/Frameworks/WebKit.framework
@@ -13,13 +13,13 @@ IMPORT: WebView
     WebView -> alloc
     rect f f -> initWithFrame:frameName:groupName: ;
 
-: window-style ( -- n )
-    {
+CONSTANT: window-style ( -- n )
+    flags{
         NSClosableWindowMask
         NSMiniaturizableWindowMask
         NSResizableWindowMask
         NSTitledWindowMask
-    } flags ;
+    }
 
 : <WebWindow> ( -- id )
     <WebView> rect window-style <ViewWindow> ;