]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of github.com:erikcharlebois/factor
authorErik Charlebois <erikcharlebois@gmail.com>
Fri, 26 Feb 2010 02:51:08 +0000 (18:51 -0800)
committerErik Charlebois <erikcharlebois@gmail.com>
Fri, 26 Feb 2010 02:51:08 +0000 (18:51 -0800)
23 files changed:
basis/classes/struct/struct-tests.factor
basis/classes/struct/struct.factor
basis/grouping/grouping-docs.factor
basis/grouping/grouping-tests.factor
basis/grouping/grouping.factor
basis/windows/com/com-tests.factor
basis/windows/com/syntax/syntax.factor
basis/windows/directx/d2d1/d2d1.factor
basis/windows/directx/d3d10/d3d10.factor
basis/windows/directx/d3d10effect/d3d10effect.factor
basis/windows/directx/d3d10misc/d3d10misc.factor
basis/windows/directx/d3d10shader/d3d10shader.factor
basis/windows/directx/d3d11/d3d11.factor
basis/windows/directx/d3d9/d3d9.factor
basis/windows/directx/d3dx10async/d3dx10async.factor
basis/windows/directx/d3dx11async/d3dx11async.factor
basis/windows/directx/d3dx11tex/d3dx11tex.factor
basis/windows/directx/dxgi/dxgi.factor
basis/windows/directx/xapofx/xapofx.factor
basis/windows/directx/xaudio2/xaudio2.factor
basis/windows/user32/user32.factor
basis/x11/xlib/xlib.factor
extra/chipmunk/ffi/ffi.factor

index c94ef48f4cea1af857ac775452a2a45fa9b29d47..dafd31efdeb580a1ea2f1bfb4078f3db4277e4d1 100644 (file)
@@ -1,10 +1,10 @@
 ! (c)Joe Groff bsd license
 USING: accessors alien alien.c-types alien.data alien.syntax ascii
-assocs byte-arrays classes.struct classes.tuple.private classes.tuple
-combinators compiler.tree.debugger compiler.units destructors
-io.encodings.utf8 io.pathnames io.streams.string kernel libc
-literals math mirrors namespaces prettyprint
-prettyprint.config see sequences specialized-arrays system
+assocs byte-arrays classes.struct classes.tuple.parser
+classes.tuple.private classes.tuple combinators compiler.tree.debugger
+compiler.units destructors io.encodings.utf8 io.pathnames
+io.streams.string kernel libc literals math mirrors namespaces
+prettyprint prettyprint.config see sequences specialized-arrays system
 tools.test parser lexer eval layouts generic.single classes ;
 FROM: math => float ;
 QUALIFIED-WITH: alien.c-types c
@@ -334,6 +334,14 @@ STRUCT: struct-that's-a-word { x int } ;
     "struct-class-test-1" parse-stream
 ] [ error>> error>> unexpected-eof? ] must-fail-with
 
+[
+    "USING: alien.c-types classes.struct ; IN: classes.struct.tests STRUCT: struct-test-duplicate-slots { x uint } { x uint } ;" eval( -- )
+] [ error>> duplicate-slot-names? ] must-fail-with
+
+[
+    "USING: alien.c-types classes.struct ; IN: classes.struct.tests STRUCT: struct-test-duplicate-slots { x uint } { x float } ;" eval( -- )
+] [ error>> duplicate-slot-names? ] must-fail-with
+
 ! S{ with non-struct type
 [
     "USE: classes.struct IN: classes.struct.tests TUPLE: not-a-struct ; S{ not-a-struct }"
index a3b198bd943f46fa91c50fb4800df69b0ca60a58..79dea73d8cd4a0478226a9caca2edc2f9bf119b5 100644 (file)
@@ -363,7 +363,8 @@ PRIVATE>
     } case ;
 
 : parse-struct-definition ( -- class slots )
-    CREATE-CLASS 8 <vector> [ parse-struct-slots ] [ ] while >array ;
+    CREATE-CLASS 8 <vector> [ parse-struct-slots ] [ ] while >array
+    dup [ name>> ] map check-duplicate-slots ;
 PRIVATE>
 
 SYNTAX: STRUCT:
index 2c2fee1d70e79233249c8803478f3652bcb2f97f..0c9db38f4bc8d29009d94fe08519af04d8736eb6 100644 (file)
@@ -8,22 +8,48 @@ ARTICLE: "grouping" "Groups and clumps"
 { $subsections groups <groups> <sliced-groups> }
 "Splitting a sequence into overlapping, fixed-length subsequences:"
 { $subsections clump }
+"Splitting a sequence into overlapping, fixed-length subsequences, wrapping around the end of the sequence:"
+{ $subsections circular-clump }
 "A virtual sequence for splitting a sequence into overlapping, fixed-length subsequences:"
 { $subsections clumps <clumps> <sliced-clumps> }
+"A virtual sequence for splitting a sequence into overlapping, fixed-length subsequences:"
+{ $subsections circular-clumps <circular-clumps> <sliced-circular-clumps> }
 "The difference can be summarized as the following:"
 { $list
     { "With groups, the subsequences form the original sequence when concatenated:"
+        { $unchecked-example
+            "USING: grouping ;"
+            "{ 1 2 3 4 } 2 group ." "{ { 1 2 } { 3 4 } }"
+        }
         { $unchecked-example
             "USING: grouping ;"
             "{ 1 2 3 4 } dup" "2 <groups> concat sequence= ." "t"
         }
     }
     { "With clumps, collecting the first element of each subsequence but the last one, together with the last subseqence, yields the original sequence:"
+        { $unchecked-example
+            "USING: grouping ;"
+            "{ 1 2 3 4 } 2 clump ." "{ { 1 2 } { 2 3 } { 3 4 } }"
+        }
         { $unchecked-example
             "USING: grouping ;"
             "{ 1 2 3 4 } dup" "2 <clumps> unclip-last [ [ first ] map ] dip append sequence= ." "t"
         }
     }
+    { "With circular clumps, collecting the first element of each subsequence yields the original sequence. Collecting the " { $snippet "n" } "th element of each subsequence would rotate the original sequence " { $snippet "n" } " elements rightward:"
+        { $unchecked-example
+            "USING: grouping ;"
+            "{ 1 2 3 4 } 2 circular-clump ." "{ { 1 2 } { 2 3 } { 3 4 } { 4 1 } }"
+        }
+        { $unchecked-example
+            "USING: grouping ;"
+            "{ 1 2 3 4 } dup" "2 <circular-clumps> [ first ] map sequence= ." "t"
+        }
+        { $unchecked-example
+            "USING: grouping ;"
+            "{ 1 2 3 4 } dup" "2 <circular-clumps> [ second ] { } map-as ." "{ 2 3 4 1 }"
+        }
+    }
 }
 $nl
 "A combinator built using clumps:"
@@ -79,18 +105,31 @@ HELP: <sliced-groups>
 } ;
 
 HELP: clumps
-{ $class-description "Instances are virtual sequences whose elements are overlapping fixed-length subsequences o an underlying sequence. Clumps are mutable and resizable if the underlying sequence is mutable and resizable, respectively."
+{ $class-description "Instances are virtual sequences whose elements are overlapping fixed-length subsequences of an underlying sequence. Clumps are mutable and resizable if the underlying sequence is mutable and resizable, respectively."
 $nl
 "New clumps are created by calling " { $link <clumps> } " and " { $link <sliced-clumps> } "." } ;
 
+HELP: circular-clumps
+{ $class-description "Instances are virtual sequences whose elements are overlapping fixed-length subsequences of an underlying sequence, beginning with every element in the original sequence and wrapping around its end. Circular clumps are mutable and resizable if the underlying sequence is mutable and resizable, respectively."
+$nl
+"New clumps are created by calling " { $link <circular-clumps> } " and " { $link <sliced-circular-clumps> } "." } ;
+
 HELP: clump
 { $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "array" "a sequence of sequences" } }
 { $description "Splits the sequence into overlapping clumps of " { $snippet "n" } " elements and collects the clumps into a new array." }
-{ $errors "Throws an error if " { $snippet "n" } " is smaller than the length of the sequence." }
+{ $errors "Throws an error if " { $snippet "n" } " is larger than the length of the sequence." }
 { $examples
     { $example "USING: grouping prettyprint ;" "{ 3 1 3 3 7 } 2 clump ." "{ { 3 1 } { 1 3 } { 3 3 } { 3 7 } }" }
 } ;
 
+HELP: circular-clump
+{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "array" "a sequence of sequences" } }
+{ $description "Splits the sequence into overlapping clumps of " { $snippet "n" } " elements, wrapping around the end of the sequence, and collects the clumps into a new array." }
+{ $errors "Throws an error if " { $snippet "n" } " is larger than the length of the sequence." }
+{ $examples
+    { $example "USING: grouping prettyprint ;" "{ 3 1 3 3 7 } 2 circular-clump ." "{ { 3 1 } { 1 3 } { 3 3 } { 3 7 } { 7 3 } }" }
+} ;
+
 HELP: <clumps>
 { $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "clumps" clumps } }
 { $description "Outputs a virtual sequence whose elements are overlapping subsequences of " { $snippet "n" } " elements from the underlying sequence." }
@@ -111,24 +150,35 @@ HELP: <clumps>
     }
 } ;
 
-HELP: <sliced-clumps>
+HELP: <circular-clumps>
 { $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "clumps" clumps } }
-{ $description "Outputs a virtual sequence whose elements are overlapping slices of " { $snippet "n" } " elements from the underlying sequence." }
+{ $description "Outputs a virtual sequence whose elements are overlapping subsequences of " { $snippet "n" } " elements from the underlying sequence, starting with each of its elements and wrapping around the end of the sequence." }
 { $examples
     { $example
         "USING: kernel sequences grouping prettyprint ;"
-        "{ 1 2 3 4 5 6 } 3 <sliced-clumps> second ."
-        "T{ slice { from 1 } { to 4 } { seq { 1 2 3 4 5 6 } } }"
+        "{ 1 2 3 4 } 3 <circular-clumps> third ."
+        "{ 3 4 1 }"
+    }
+} ;
+
+HELP: <sliced-circular-clumps>
+{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "clumps" clumps } }
+{ $description "Outputs a virtual sequence whose elements are overlapping slices of " { $snippet "n" } " elements from the underlying sequence, starting with each of its elements and wrapping around the end of the sequence." }
+{ $examples
+    { $example
+        "USING: arrays kernel sequences grouping prettyprint ;"
+        "{ 1 2 3 4 } 3 <sliced-circular-clumps> third >array ."
+        "{ 3 4 1 }"
     }
 } ;
 
-{ clumps groups } related-words
+{ clumps circular-clumps groups } related-words
 
-{ clump group } related-words
+{ clump circular-clump group } related-words
 
-{ <clumps> <groups> } related-words
+{ <clumps> <circular-clumps> <groups> } related-words
 
-{ <sliced-clumps> <sliced-groups> } related-words
+{ <sliced-clumps> <sliced-circular-clumps> <sliced-groups> } related-words
 
 HELP: monotonic?
 { $values { "seq" sequence } { "quot" { $quotation "( elt elt -- ? )" } } { "?" "a boolean" } }
index 60500558a72f5a9270743d050f609e1fe80df588..9340b322e2d9e2da91a40a4e9c6300e3d29417e2 100644 (file)
@@ -17,6 +17,15 @@ IN: grouping.tests
 [ 1 ] [ { 1 2 } 2 <clumps> length ] unit-test
 [ 2 ] [ { 1 2 3 } 2 <clumps> length ] unit-test
 
+[ { } 2 <circular-clumps> length ] must-fail
+[ { 1 } 2 <circular-clumps> length ] must-fail
+
+[ 2 ] [ { 1 2 } 2 <circular-clumps> length ] unit-test
+[ 3 ] [ { 1 2 3 } 2 <circular-clumps> length ] unit-test
+
+[ { { 1 2 } { 2 1 }         } ] [ { 1 2   } 2 circular-clump ] unit-test
+[ { { 1 2 } { 2 3 } { 3 1 } } ] [ { 1 2 3 } 2 circular-clump ] unit-test
+
 [ 1 ] [ V{ } 2 <clumps> 0 over set-length seq>> length ] unit-test
 [ 2 ] [ V{ } 2 <clumps> 1 over set-length seq>> length ] unit-test
 [ 3 ] [ V{ } 2 <clumps> 2 over set-length seq>> length ] unit-test
index 4ee0d0c38519e9833db99f5745f7d032f9353a65..0dced6ad9d30b068a3252c4bec7d219b8ed74d34 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2005, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel math math.order strings arrays vectors sequences
-sequences.private accessors fry ;
+sequences.private accessors fry combinators.short-circuit ;
 IN: grouping
 
 <PRIVATE
@@ -59,6 +59,13 @@ TUPLE: chunking-seq { seq read-only } { n read-only } ;
 : new-groups ( seq n class -- groups )
     [ check-groups ] dip boa ; inline
 
+: slice-mod ( n length -- n' )
+    2dup >= [ - ] [ drop ] if ; inline
+
+: check-circular-clumps ( seq n -- seq n )
+    2dup { [ nip 0 <= ] [ swap length > ] } 2|| 
+    [ "Invalid clump size" throw ] when ; inline
+
 PRIVATE>
 
 TUPLE: groups < chunking-seq ;
@@ -106,3 +113,37 @@ INSTANCE: sliced-clumps abstract-clumps
 : all-equal? ( seq -- ? ) [ = ] monotonic? ;
 
 : all-eq? ( seq -- ? ) [ eq? ] monotonic? ;
+
+TUPLE: circular-slice < slice ;
+M: circular-slice virtual@
+    [ from>> + ] [ seq>> ] bi [ length slice-mod ] keep ; inline
+
+C: <circular-slice> circular-slice
+
+TUPLE: sliced-circular-clumps < chunking-seq ;
+INSTANCE: sliced-circular-clumps sequence
+
+M: sliced-circular-clumps length
+    seq>> length ; inline
+
+M: sliced-circular-clumps nth
+    [ n>> over + ] [ seq>> ] bi <circular-slice> ; inline
+
+: <sliced-circular-clumps> ( seq n -- clumps )
+    check-circular-clumps sliced-circular-clumps boa ; inline
+
+TUPLE: circular-clumps < chunking-seq ;
+INSTANCE: circular-clumps sequence
+
+M: circular-clumps length
+    seq>> length ; inline
+
+M: circular-clumps nth
+    [ n>> over + ] [ seq>> ] bi [ <circular-slice> ] [ like ] bi ; inline
+
+: <circular-clumps> ( seq n -- clumps )
+    check-circular-clumps circular-clumps boa ; inline
+
+: circular-clump ( seq n -- array )
+    <circular-clumps> { } like ; inline
+
index f0b4eadb9f545cad974f32ea8a2a6112e1782404..fdc48adfbe5fc8fb2ea9fae2a9e5c8a0affa56ec 100644 (file)
@@ -16,6 +16,9 @@ COM-INTERFACE: IUnrelated IUnknown {b06ac3f4-30e4-406b-a7cd-c29cead4552c}
     int xPlus ( int y )
     int xMulAdd ( int mul, int add ) ;
 
+COM-INTERFACE: ISelfReferential IUnknown {d4f45bf8-f720-4701-a09d-e8e341981121}
+    ISelfReferential* selfReference ( ) ;
+
 { GUID: {216fb341-0eb2-44b1-8edb-60b76e353abc} } [ ISimple-iid ] unit-test
 { GUID: {9620ecec-8438-423b-bb14-86f835aa40dd} } [ IInherited-iid ] unit-test
 { GUID: {00000000-0000-0000-C000-000000000046} } [ IUnknown-iid ] unit-test
index 7e93a6e9f8e3c8b8beb8523e0da0b08de0844ec4..5230d9497e04f07fd51e4240e15693d843d891d8 100644 (file)
@@ -3,6 +3,7 @@ effects kernel windows.ole32 parser lexer splitting grouping
 sequences namespaces assocs quotations generalizations
 accessors words macros alien.syntax fry arrays layouts math
 classes.struct windows.kernel32 ;
+FROM: alien.parser.private => return-type-name ;
 IN: windows.com.syntax
 
 <PRIVATE
@@ -71,7 +72,7 @@ ERROR: no-com-interface interface ;
 : (stack-effect-from-return-and-parameters) ( return parameters -- stack-effect )
     swap
     [ [ second ] map ]
-    [ dup void? [ drop { } ] [ name>> 1array ] if ] bi*
+    [ dup void? [ drop { } ] [ return-type-name 1array ] if ] bi*
     <effect> ;
 
 : (define-word-for-function) ( function interface n -- )
@@ -83,17 +84,16 @@ ERROR: no-com-interface interface ;
 
 : define-words-for-com-interface ( definition -- )
     [ [ (iid-word) ] [ iid>> 1quotation ] bi (( -- iid )) define-declared ]
-    [ word>> void* swap typedef ]
     [
         dup family-tree-functions
         [ (define-word-for-function) ] with each-index
-    ]
-    tri ;
+    ] bi ;
 
 PRIVATE>
 
 SYNTAX: COM-INTERFACE:
     CREATE-C-TYPE
+    void* over typedef
     scan-object find-com-interface-definition
     scan string>guid
     parse-com-functions
index cf9e5a3a98c6236b9fab78356857acfb909b2713..4a8b44f63d0555f89ed92f7303f41cd90220af8b 100644 (file)
@@ -303,6 +303,9 @@ TYPEDEF: int D2D1_FACTORY_TYPE
 STRUCT: D2D1_FACTORY_OPTIONS
     { debugLevel D2D1_DEBUG_LEVEL } ;
 
+C-TYPE: ID2D1Factory
+C-TYPE: ID2D1BitmapRenderTarget 
+
 COM-INTERFACE: ID2D1Resource IUnknown {2cd90691-12e2-11dc-9fed-001143a055f9}
     void GetFactory ( ID2D1Factory** factory ) ;
 
index 561aa47acd6cc2ccd5c1612b1f8752711c7f601c..4f23d41218e4e23057cbba625002f48b10738424 100644 (file)
@@ -382,6 +382,7 @@ STRUCT: D3D10_BOX
     { bottom UINT }
     { back   UINT } ;
 
+C-TYPE: ID3D10Device
 COM-INTERFACE: ID3D10DeviceChild IUnknown {9B7E4C00-342C-4106-A19F-4F2704F689F0}
     void GetDevice ( ID3D10Device** ppDevice )
     HRESULT GetPrivateData ( LPGUID guid, UINT* pDataSize, void* pData )
index 1d809b386272c80039a2e347ea798b3e3457138a..873f8e26e8a69acac1a87a8f4e738080015b5d7c 100644 (file)
@@ -1,5 +1,5 @@
 USING: alien.c-types alien.syntax classes.struct windows.com
-windows.com.syntax windows.directx.d3d10
+windows.com.syntax windows.directx.d3d10 windows.directx.d3d10misc
 windows.directx.d3d10shader windows.types ;
 IN: windows.directx.d3d10effect
 
index b6f5f12bcea4d5cbc2ede49e380443eab97b28cd..a5809009ea6f6041518c136986ee3e8ae2e05c97 100644 (file)
@@ -1,5 +1,5 @@
 USING: alien.c-types alien.syntax windows.com windows.com.syntax
-windows.directx.dxgi windows.types alien.libraries ;
+windows.directx.d3d10 windows.directx.dxgi windows.types ;
 IN: windows.directx.d3d10misc
 
 LIBRARY: d3d10
index 4507441fd0f92dfdbbc60b8d94bf3c0c635a2d5d..787698e5030dc1a6f189e758beb39a47f76aac1c 100644 (file)
@@ -1,5 +1,6 @@
-USING: alien.syntax alien.c-types classes.struct windows.types windows.com
-windows.com.syntax windows.directx.d3d10 ;
+USING: alien.c-types alien.syntax classes.struct windows.com
+windows.com.syntax windows.directx.d3d10 windows.directx.d3d10misc
+windows.types ;
 IN: windows.directx.d3d10shader
 
 LIBRARY: d3d10
index 505ac4bc6744c95dec4dad0f72dbece4993dbd73..8382c11dc28857f80196d3275c12067ff678c83a 100644 (file)
@@ -634,6 +634,9 @@ STRUCT: D3D11_BOX
     { bottom UINT }
     { back   UINT } ;
 
+C-TYPE: ID3D11Device
+C-TYPE: ID3D11ClassLinkage
+
 COM-INTERFACE: ID3D11DeviceChild IUnknown {1841e5c8-16b0-489b-bcc8-44cfb0d5deae}
     void GetDevice ( ID3D11Device** ppDevice )
     HRESULT GetPrivateData ( REFGUID guid, UINT* pDataSize, void* pData )
index cedfefc103838baa13f56b6b69ab55dcc6175d42..d4e06ae8c9ddd43284e1190b8692a54a0069cfe9 100644 (file)
@@ -23,6 +23,8 @@ FUNCTION: BOOL D3DPERF_QueryRepeatFrame ( ) ;
 FUNCTION: void D3DPERF_SetOptions ( DWORD dwOptions ) ;
 FUNCTION: DWORD D3DPERF_GetStatus ( ) ;
 
+C-TYPE: IDirect3DDevice9
+
 COM-INTERFACE: IDirect3D9 IUnknown {81BDCBCA-64D4-426d-AE8D-AD0147F4275C}
     HRESULT RegisterSoftwareDevice ( void* pInitializeFunction )
     UINT GetAdapterCount ( )
@@ -51,6 +53,17 @@ C-TYPE: IDirect3DVertexDeclaration9
 C-TYPE: IDirect3DVertexShader9
 C-TYPE: IDirect3DIndexBuffer9
 C-TYPE: IDirect3DPixelShader9
+C-TYPE: IDirect3DSwapChain9
+C-TYPE: IDirect3DTexture9
+C-TYPE: IDirect3DVolumeTexture9
+C-TYPE: IDirect3DCubeTexture9
+C-TYPE: IDirect3DStateBlock9
+C-TYPE: IDirect3DQuery9
+C-TYPE: IDirect3DVolume9
+C-TYPE: IDirect3D9Ex
+C-TYPE: IDirect3DDevice9Ex
+C-TYPE: IDirect3DAuthenticatedChannel9
+C-TYPE: IDirect3DCryptoSession9
 
 COM-INTERFACE: IDirect3DDevice9 IUnknown {D0223B96-BF7A-43fd-92BD-A43B0D82B9EB}
     HRESULT TestCooperativeLevel ( )
index e2165302f47fde1e1d9f2d986936c9d25a36b3f1..e7fbcf573e63fb054e2ad3556f58d62649933d27 100644 (file)
@@ -1,5 +1,5 @@
-USING: alien.syntax windows.directx.d3d10 windows.directx.d3d10shader
-windows.types ;
+USING: alien.syntax windows.directx.d3d10 windows.directx.d3d10misc
+windows.directx.d3d10shader windows.directx.d3dx10core windows.types ;
 IN: windows.directx.d3dx10async
 
 LIBRARY: d3dx10
@@ -8,6 +8,7 @@ C-TYPE: ID3DX10ThreadPump
 C-TYPE: ID3D10EffectPool
 C-TYPE: D3DX10_IMAGE_LOAD_INFO
 C-TYPE: D3DX10_IMAGE_INFO
+C-TYPE: ID3D10Effect
 
 FUNCTION: HRESULT D3DX10CompileFromFileA ( LPCSTR pSrcFile, D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude,
         LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult ) ;
index 369ffd6683e15ce7d89079613471ae43f56e7859..bea30ecb1a07acfba323fd6b3f889c7054834059 100644 (file)
@@ -1,6 +1,6 @@
-USING: alien.syntax alien.c-types classes.struct windows.types
-windows.directx.d3d10shader windows.directx.d3dx11core
-windows.directx.d3d11 windows.directx.d3dx11tex ;
+USING: alien.syntax windows.directx.d3d10misc
+windows.directx.d3d10shader windows.directx.d3d11
+windows.directx.d3dx11core windows.directx.d3dx11tex windows.types ;
 IN: windows.directx.d3dx11async
 
 LIBRARY: d3dx11
index d21fa0c72acc28449f1539a2abea661d96169b99..19425535e890c63c16b43b31229268a6d4e0c7ae 100644 (file)
@@ -1,6 +1,6 @@
-USING: alien.syntax alien.c-types classes.struct windows.types
-windows.directx.dxgiformat windows.directx.d3d11
-windows.directx.d3dx11core ;
+USING: alien.c-types alien.syntax classes.struct
+windows.directx.d3d10misc windows.directx.d3d11
+windows.directx.d3dx11core windows.directx.dxgiformat windows.types ;
 IN: windows.directx.d3dx11tex
 
 LIBRARY: d3dx11
index 6537de885f52db8bd06bd2ec2278c0ca19eddcd8..5d2ae5b990a3a1b6cdddebd4ec9a4895df5e6c42 100644 (file)
@@ -119,6 +119,7 @@ COM-INTERFACE: IDXGISurface1 IDXGISurface {4AE63092-6327-4c1b-80AE-BFE12EA32B86}
 HRESULT GetDC ( BOOL Discard, HDC* phdc )
 HRESULT ReleaseDC ( RECT* pDirtyRect ) ;
 
+C-TYPE: IDXGIOutput 
 COM-INTERFACE: IDXGIAdapter IDXGIObject {2411e7e1-12ac-4ccf-bd14-9798e8534dc0}
 HRESULT EnumOutputs ( UINT Output, IDXGIOutput** ppOutput )
 HRESULT GetDesc ( DXGI_ADAPTER_DESC* pDesc )
@@ -201,13 +202,13 @@ STRUCT: DXGI_DISPLAY_COLOR_SPACE
 { PrimaryCoordinates FLOAT[8][2] }
 { WhitePoints FLOAT[16][2] } ;
 
+COM-INTERFACE: IDXGIAdapter1 IDXGIAdapter {29038f61-3839-4626-91fd-086879011a05}
+HRESULT GetDesc1 ( DXGI_ADAPTER_DESC1* pDesc ) ;
+
 COM-INTERFACE: IDXGIFactory1 IDXGIFactory {770aae78-f26f-4dba-a829-253c83d1b387}
 HRESULT EnumAdapters1 ( UINT Adapter, IDXGIAdapter1** ppAdapter )
 BOOL IsCurrent ( ) ;
 
-COM-INTERFACE: IDXGIAdapter1 IDXGIAdapter {29038f61-3839-4626-91fd-086879011a05}
-HRESULT GetDesc1 ( DXGI_ADAPTER_DESC1* pDesc ) ;
-
 COM-INTERFACE: IDXGIDevice1 IDXGIDevice {77db970f-6276-48ba-ba28-070143b4392c}
 HRESULT SetMaximumFrameLatency ( UINT MaxLatency )
 HRESULT GetMaximumFrameLatency ( UINT* pMaxLatency ) ;
index 1255880c4c844db85ac37760d2a0877f48e6e5f1..594ad9ecbeb03f232f816dd8762919aab65529b0 100644 (file)
@@ -1,5 +1,5 @@
-USING: alien.c-types alien.syntax classes.struct windows.ole32
-windows.types ;
+USING: alien.c-types alien.syntax classes.struct windows.com
+windows.ole32 windows.types ;
 IN: windows.directx.xapofx
 
 LIBRARY: xapofx
index 67a9234367a3432d3f07be0a425283eb76bab1e7..303eaf26b1ee809ce7f7b391305c5b169267a2a6 100644 (file)
@@ -203,6 +203,9 @@ CONSTANT: XAUDIO2_LOG_STREAMING  HEX: 1000
 
 C-TYPE: IXAudio2EngineCallback
 C-TYPE: IXAudio2VoiceCallback
+C-TYPE: IXAudio2SourceVoice
+C-TYPE: IXAudio2SubmixVoice
+C-TYPE: IXAudio2MasteringVoice
 
 COM-INTERFACE: IXAudio2 IUnknown {8bcf1f58-9fe7-4583-8ac6-e2adc465c8bb}
     HRESULT GetDeviceCount ( UINT32* pCount )
index 9908bb1f1be2e61f1155c119039fb81a3d3fe0e2..b9d5cc95c4a8db591ceb0d0d86254c0bb3372019 100644 (file)
@@ -927,6 +927,87 @@ STRUCT: RAWINPUTDEVICELIST
     { dwType  DWORD  } ;
 TYPEDEF: RAWINPUTDEVICELIST* PRAWINPUTDEVICELIST
 
+CONSTANT: CCHFORMNAME 32
+
+CONSTANT: CDS_UPDATEREGISTRY      HEX: 00000001
+CONSTANT: CDS_TEST                HEX: 00000002
+CONSTANT: CDS_FULLSCREEN          HEX: 00000004
+CONSTANT: CDS_GLOBAL              HEX: 00000008
+CONSTANT: CDS_SET_PRIMARY         HEX: 00000010
+CONSTANT: CDS_RESET               HEX: 40000000
+CONSTANT: CDS_SETRECT             HEX: 20000000
+CONSTANT: CDS_NORESET             HEX: 10000000
+
+CONSTANT: DISP_CHANGE_SUCCESSFUL 0
+CONSTANT: DISP_CHANGE_RESTART 1
+CONSTANT: DISP_CHANGE_FAILED     -1
+CONSTANT: DISP_CHANGE_BADMODE    -2
+CONSTANT: DISP_CHANGE_NOTUPDATED -3
+CONSTANT: DISP_CHANGE_BADFLAGS   -4
+CONSTANT: DISP_CHANGE_BADPARAM   -5
+
+
+
+STRUCT: DEVMODE
+    { dmDeviceName TCHAR[CCHDEVICENAME] }
+    { dmSpecVersion WORD }
+    { dmDriverVersion WORD }
+    { dmSize WORD }
+    { dmDriverExtra WORD }
+    { dmFields DWORD }
+
+    { dmOrientation short }
+    { dmPaperSize short }
+    { dmPaperLength short }
+    { dmPaperWidth short }
+    { dmScale short }
+    { dmCopies short }
+    { dmDefaultSource short }
+    { dmPrintQuality short }
+
+    { dmColor short }
+    { dmDuplex short }
+    { dmYResolution short }
+    { dmTTOption short }
+    { dmCollate short }
+    { dmFormName TCHAR[CCHFORMNAME] }
+    { dmLogPixels WORD }
+    { dmBitsPerPel DWORD }
+    { dmPelsWidth DWORD }
+    { dmPelsHeight DWORD }
+    { dmDisplayFlags DWORD }
+    { dmDisplayFrequency DWORD }
+    { dmiCMMethod DWORD }
+    { dmICMIntent DWORD }
+
+    { dmMediaType DWORD }
+    { dmDitherType DWORD }
+    { dmReserved1 DWORD }
+    { dmReserved2 DWORD }
+    { dmPanningWidth DWORD } ;
+
+! union { DWORD dmDisplayFlags; DWORD dmNup; } ;
+  ! union {
+    ! struct {
+      ! short dmOrientation;
+      ! short dmPaperSize;
+      ! short dmPaperLength;
+      ! short dmPaperWidth;
+      ! short dmScale;
+      ! short dmCopies;
+      ! short dmDefaultSource;
+      ! short dmPrintQuality;
+    ! } ;
+    ! struct {
+      ! POINTL dmPosition;
+      ! DWORD dmDisplayOrientation;
+      ! DWORD dmDisplayFixedOutput;
+    ! } ;
+  ! } ;
+
+TYPEDEF: DEVMODE* PDEVMODE
+TYPEDEF: DEVMODE* LPDEVMODE
+
 LIBRARY: user32
 
 FUNCTION: HKL ActivateKeyboardLayout ( HKL hkl, UINT Flags ) ;
@@ -965,10 +1046,10 @@ FUNCTION: HDC BeginPaint ( HWND hwnd, LPPAINTSTRUCT lpPaint ) ;
 ! FUNCTION: CascadeChildWindows
 ! FUNCTION: CascadeWindows
 ! FUNCTION: ChangeClipboardChain
-! FUNCTION: ChangeDisplaySettingsA
-! FUNCTION: ChangeDisplaySettingsExA
-! FUNCTION: ChangeDisplaySettingsExW
-! FUNCTION: ChangeDisplaySettingsW
+FUNCTION: LONG ChangeDisplaySettingsExW ( LPCTSTR lpszDeviceName, DEVMODE *lpDevMode, HWND hwnd, DWORD dwFlags, LPVOID lParam ) ;
+FUNCTION: LONG ChangeDisplaySettingsW ( DEVMODE *lpDevMode, DWORD dwFlags ) ;
+ALIAS: ChangeDisplaySettingsEx ChangeDisplaySettingsExW
+ALIAS: ChangeDisplaySettings ChangeDisplaySettingsW
 ! FUNCTION: ChangeMenuA
 ! FUNCTION: ChangeMenuW
 ! FUNCTION: CharLowerA
@@ -1173,7 +1254,8 @@ FUNCTION: UINT EnumClipboardFormats ( UINT format ) ;
 ! FUNCTION: EnumDisplaySettingsA
 ! FUNCTION: EnumDisplaySettingsExA
 ! FUNCTION: EnumDisplaySettingsExW
-! FUNCTION: EnumDisplaySettingsW
+FUNCTION: BOOL EnumDisplaySettingsW ( LPCTSTR lpszDeviceName, DWORD iModeNum, DEVMODE *lpDevMode ) ;
+ALIAS: EnumDisplaySettings EnumDisplaySettingsW
 ! FUNCTION: EnumPropsA
 ! FUNCTION: EnumPropsExA
 ! FUNCTION: EnumPropsExW
@@ -1236,7 +1318,7 @@ FUNCTION: DWORD GetClipboardSequenceNumber ( ) ;
 ! FUNCTION: GetCursorPos
 FUNCTION: HDC GetDC ( HWND hWnd ) ;
 FUNCTION: HDC GetDCEx ( HWND hWnd, HRGN hrgnClip, DWORD flags ) ;
-! FUNCTION: GetDesktopWindow
+FUNCTION: HWND GetDesktopWindow ( ) ;
 ! FUNCTION: GetDialogBaseUnits
 ! FUNCTION: GetDlgCtrlID
 ! FUNCTION: GetDlgItem
@@ -1345,6 +1427,8 @@ FUNCTION: HWND GetWindow ( HWND hWnd, UINT uCmd ) ;
 ! FUNCTION: GetWindowLongW
 FUNCTION: LONG_PTR GetWindowLongW ( HANDLE hWnd, int index ) ;
 ALIAS: GetWindowLong GetWindowLongW
+
+FUNCTION: LONG_PTR GetWindowLongPtr ( HWND hWnd, int nIndex ) ;
 ! FUNCTION: GetWindowModuleFileName
 ! FUNCTION: GetWindowModuleFileNameA
 ! FUNCTION: GetWindowModuleFileNameW
@@ -1692,6 +1776,8 @@ ALIAS: SetWindowLong SetWindowLongW
 ! FUNCTION: SetWindowPlacement
 FUNCTION: BOOL SetWindowPos ( HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags ) ;
 
+FUNCTION: LONG_PTR SetWindowLongPtr ( HWND hWnd, int nIndex, LONG_PTR dwNewLong ) ;
+
 : HWND_BOTTOM ( -- alien ) 1 <alien> ;
 : HWND_NOTOPMOST ( -- alien ) -2 <alien> ;
 CONSTANT: HWND_TOP f
index de01d509dd0686d6fb979c2f1cd3d7e019401da1..e86bb5e8c37932b0406f1b5bccc0e3f2d9417aa7 100644 (file)
@@ -1010,14 +1010,7 @@ STRUCT: XKeymapEvent
 { send_event Bool }
 { display Display* }
 { window Window }
-{ pad int }
-{ pad int }
-{ pad int }
-{ pad int }
-{ pad int }
-{ pad int }
-{ pad int }
-{ pad int } ;
+{ pad int[8] } ;
 
 UNION-STRUCT: XEvent
 { int int }
index e2adf2dff7cd478d5e3b6af72d497d3d2b65a45d..0142b57a7727a87190cedf48b8da46fa4f699d44 100644 (file)
@@ -2,15 +2,19 @@
 ! See http:// factorcode.org/license.txt for BSD license.
 USING: accessors alien.c-types alien.syntax classes.struct combinators
 combinators.short-circuit kernel math math.order sequences
-specialized-arrays.instances.alien.c-types.void* typed
-specialized-arrays locals system alien.libraries ;
+typed specialized-arrays locals system alien.libraries ;
+SPECIALIZED-ARRAY: void*
 IN: chipmunk.ffi
 
-<< "chipmunk" {
-        { [ os windows? ] [ "chipmunk.dll" ] }
-        { [ os macosx? ] [ "libchipmunk.dylib"  ] }
-        { [ os unix?  ] [ "libchipmunk.so" ] }
-    } cond "cdecl" add-library >>
+<<
+"chipmunk" {
+    { [ os windows? ] [ "chipmunk.dll" ] }
+    { [ os macosx? ] [ "libchipmunk.dylib"  ] }
+    { [ os unix?  ] [ "libchipmunk.so" ] }
+} cond "cdecl" add-library
+
+"chipmunk" deploy-library
+>>
 LIBRARY: chipmunk
 
 ! chipmunk_types.h