M: array c-type-stack-align? drop f ;
-M: array unbox-parameter drop "void*" unbox-parameter ;
+M: array unbox-parameter drop void* unbox-parameter ;
-M: array unbox-return drop "void*" unbox-return ;
+M: array unbox-return drop void* unbox-return ;
-M: array box-parameter drop "void*" box-parameter ;
+M: array box-parameter drop void* box-parameter ;
-M: array box-return drop "void*" box-return ;
+M: array box-return drop void* box-return ;
-M: array stack-size drop "void*" stack-size ;
+M: array stack-size drop void* stack-size ;
M: array c-type-boxer-quot
unclip
M: array c-type-unboxer-quot drop [ >c-ptr ] ;
PREDICATE: string-type < pair
- first2 [ "char*" = ] [ word? ] bi* and ;
+ first2 [ char* = ] [ word? ] bi* and ;
M: string-type c-type ;
M: string-type c-type-boxed-class drop object ;
M: string-type heap-size
- drop "void*" heap-size ;
+ drop void* heap-size ;
M: string-type c-type-align
- drop "void*" c-type-align ;
+ drop void* c-type-align ;
M: string-type c-type-stack-align?
- drop "void*" c-type-stack-align? ;
+ drop void* c-type-stack-align? ;
M: string-type unbox-parameter
- drop "void*" unbox-parameter ;
+ drop void* unbox-parameter ;
M: string-type unbox-return
- drop "void*" unbox-return ;
+ drop void* unbox-return ;
M: string-type box-parameter
- drop "void*" box-parameter ;
+ drop void* box-parameter ;
M: string-type box-return
- drop "void*" box-return ;
+ drop void* box-return ;
M: string-type stack-size
- drop "void*" stack-size ;
+ drop void* stack-size ;
M: string-type c-type-rep
drop int-rep ;
M: string-type c-type-boxer
- drop "void*" c-type-boxer ;
+ drop void* c-type-boxer ;
M: string-type c-type-unboxer
- drop "void*" c-type-unboxer ;
+ drop void* c-type-unboxer ;
M: string-type c-type-boxer-quot
second '[ _ alien>string ] ;
M: string-type c-type-setter
drop [ set-alien-cell ] ;
-{ "char*" utf8 } "char*" typedef
-"char*" "uchar*" typedef
+{ char* utf8 } char* typedef
+char* uchar* typedef
+char char* "pointer-c-type" set-word-prop
+uchar uchar* "pointer-c-type" set-word-prop
TYPEDEF: uchar* MyLPBYTE
-[ t ] [ { "char*" utf8 } c-type "MyLPBYTE" c-type = ] unit-test
+[ t ] [ { char* utf8 } c-type "MyLPBYTE" c-type = ] unit-test
[
0 B{ 1 2 3 4 } <displaced-alien> <void*>
cpu.architecture alien alien.accessors alien.strings quotations
layouts system compiler.units io io.files io.encodings.binary
io.streams.memory accessors combinators effects continuations fry
-classes vocabs vocabs.loader ;
+classes vocabs vocabs.loader words.symbol ;
+QUALIFIED: math
IN: alien.c-types
+SYMBOLS:
+ char uchar
+ short ushort
+ int uint
+ long ulong
+ longlong ulonglong
+ float double
+ void* bool
+ void ;
+
DEFER: <int>
DEFER: *char
ERROR: no-c-type name ;
-: (c-type) ( name -- type/f )
- c-types get-global at dup [
- dup string? [ (c-type) ] when
- ] when ;
+PREDICATE: c-type-word < word
+ "c-type" word-prop ;
+
+UNION: c-type-name string c-type-word ;
! C type protocol
GENERIC: c-type ( name -- type ) foldable
-: resolve-pointer-type ( name -- name )
- c-types get at dup string?
- [ "*" append ] [ drop "void*" ] if
- c-type ;
+GENERIC: resolve-pointer-type ( name -- c-type )
+
+M: word resolve-pointer-type
+ dup "pointer-c-type" word-prop
+ [ ] [ drop void* ] ?if ;
+M: string resolve-pointer-type
+ dup "*" append dup c-types get at
+ [ nip ] [
+ drop
+ c-types get at dup c-type-name?
+ [ resolve-pointer-type ] [ drop void* ] if
+ ] if ;
: resolve-typedef ( name -- type )
- dup string? [ c-type ] when ;
+ dup c-type-name? [ c-type ] when ;
-: parse-array-type ( name -- array )
+: parse-array-type ( name -- dims type )
"[" split unclip
- [ [ "]" ?tail drop string>number ] map ] dip prefix ;
+ [ [ "]" ?tail drop string>number ] map ] dip ;
M: string c-type ( name -- type )
CHAR: ] over member? [
- parse-array-type
+ parse-array-type prefix
] [
- dup c-types get at [
- resolve-typedef
- ] [
+ dup c-types get at [ ] [
"*" ?tail [ resolve-pointer-type ] [ no-c-type ] if
- ] ?if
+ ] ?if resolve-typedef
] if ;
+M: word c-type
+ "c-type" word-prop resolve-typedef ;
+
+: void? ( c-type -- ? )
+ { void "void" } member? ;
+
GENERIC: c-struct? ( type -- ? )
M: object c-struct?
drop f ;
-M: string c-struct?
- dup "void" = [ drop f ] [ c-type c-struct? ] if ;
+M: c-type-name c-struct?
+ dup void? [ drop f ] [ c-type c-struct? ] if ;
! These words being foldable means that words need to be
! recompiled if a C type is redefined. Even so, folding the
! size facilitates some optimizations.
GENERIC: heap-size ( type -- size ) foldable
-M: string heap-size c-type heap-size ;
+M: c-type-name heap-size c-type heap-size ;
M: abstract-c-type heap-size size>> ;
GENERIC: <c-array> ( len c-type -- array )
-M: string <c-array>
+M: c-type-name <c-array>
c-array-constructor execute( len -- array ) ; inline
GENERIC: (c-array) ( len c-type -- array )
-M: string (c-array)
+M: c-type-name (c-array)
c-(array)-constructor execute( len -- array ) ; inline
GENERIC: <c-direct-array> ( alien len c-type -- array )
-M: string <c-direct-array>
+M: c-type-name <c-direct-array>
c-direct-array-constructor execute( alien len -- array ) ; inline
: malloc-array ( n type -- alien )
M: abstract-c-type c-type-class class>> ;
-M: string c-type-class c-type c-type-class ;
+M: c-type-name c-type-class c-type c-type-class ;
GENERIC: c-type-boxed-class ( name -- class )
M: abstract-c-type c-type-boxed-class boxed-class>> ;
-M: string c-type-boxed-class c-type c-type-boxed-class ;
+M: c-type-name c-type-boxed-class c-type c-type-boxed-class ;
GENERIC: c-type-boxer ( name -- boxer )
M: c-type c-type-boxer boxer>> ;
-M: string c-type-boxer c-type c-type-boxer ;
+M: c-type-name c-type-boxer c-type c-type-boxer ;
GENERIC: c-type-boxer-quot ( name -- quot )
M: abstract-c-type c-type-boxer-quot boxer-quot>> ;
-M: string c-type-boxer-quot c-type c-type-boxer-quot ;
+M: c-type-name c-type-boxer-quot c-type c-type-boxer-quot ;
GENERIC: c-type-unboxer ( name -- boxer )
M: c-type c-type-unboxer unboxer>> ;
-M: string c-type-unboxer c-type c-type-unboxer ;
+M: c-type-name c-type-unboxer c-type c-type-unboxer ;
GENERIC: c-type-unboxer-quot ( name -- quot )
M: abstract-c-type c-type-unboxer-quot unboxer-quot>> ;
-M: string c-type-unboxer-quot c-type c-type-unboxer-quot ;
+M: c-type-name c-type-unboxer-quot c-type c-type-unboxer-quot ;
GENERIC: c-type-rep ( name -- rep )
M: c-type c-type-rep rep>> ;
-M: string c-type-rep c-type c-type-rep ;
+M: c-type-name c-type-rep c-type c-type-rep ;
GENERIC: c-type-getter ( name -- quot )
M: c-type c-type-getter getter>> ;
-M: string c-type-getter c-type c-type-getter ;
+M: c-type-name c-type-getter c-type c-type-getter ;
GENERIC: c-type-setter ( name -- quot )
M: c-type c-type-setter setter>> ;
-M: string c-type-setter c-type c-type-setter ;
+M: c-type-name c-type-setter c-type c-type-setter ;
GENERIC: c-type-align ( name -- n )
M: abstract-c-type c-type-align align>> ;
-M: string c-type-align c-type c-type-align ;
+M: c-type-name c-type-align c-type c-type-align ;
GENERIC: c-type-stack-align? ( name -- ? )
M: c-type c-type-stack-align? stack-align?>> ;
-M: string c-type-stack-align? c-type c-type-stack-align? ;
+M: c-type-name c-type-stack-align? c-type c-type-stack-align? ;
: c-type-box ( n type -- )
[ c-type-rep ] [ c-type-boxer [ "No boxer" throw ] unless* ] bi
M: c-type box-parameter c-type-box ;
-M: string box-parameter c-type box-parameter ;
+M: c-type-name box-parameter c-type box-parameter ;
GENERIC: box-return ( ctype -- )
M: c-type box-return f swap c-type-box ;
-M: string box-return c-type box-return ;
+M: c-type-name box-return c-type box-return ;
GENERIC: unbox-parameter ( n ctype -- )
M: c-type unbox-parameter c-type-unbox ;
-M: string unbox-parameter c-type unbox-parameter ;
+M: c-type-name unbox-parameter c-type unbox-parameter ;
GENERIC: unbox-return ( ctype -- )
M: c-type unbox-return f swap c-type-unbox ;
-M: string unbox-return c-type unbox-return ;
+M: c-type-name unbox-return c-type unbox-return ;
GENERIC: stack-size ( type -- size ) foldable
-M: string stack-size c-type stack-size ;
+M: c-type-name stack-size c-type stack-size ;
M: c-type stack-size size>> cell align ;
\ swap , [ heap-size , [ * >fixnum ] % ] [ % ] bi*
] [ ] make ;
-: typedef ( old new -- ) c-types get set-at ;
+GENERIC: typedef ( old new -- )
+
+PREDICATE: typedef-word < c-type-word
+ "c-type" word-prop c-type-name? ;
+
+M: string typedef ( old new -- ) c-types get set-at ;
+M: word typedef ( old new -- )
+ {
+ [ nip define-symbol ]
+ [ name>> typedef ]
+ [ swap "c-type" set-word-prop ]
+ [
+ swap dup c-type-name? [
+ resolve-pointer-type
+ "pointer-c-type" set-word-prop
+ ] [ 2drop ] if
+ ]
+ } 2cleave ;
TUPLE: long-long-type < c-type ;
: define-primitive-type ( type name -- )
[ typedef ]
- [ define-deref ]
- [ define-out ]
+ [ name>> define-deref ]
+ [ name>> define-out ]
tri ;
: malloc-file-contents ( path -- alien len )
binary file-contents [ malloc-byte-array ] [ length ] bi ;
: if-void ( type true false -- )
- pick "void" = [ drop nip call ] [ nip call ] if ; inline
+ pick void? [ drop nip call ] [ nip call ] if ; inline
CONSTANT: primitive-types
{
- "char" "uchar"
- "short" "ushort"
- "int" "uint"
- "long" "ulong"
- "longlong" "ulonglong"
- "float" "double"
- "void*" "bool"
+ char uchar
+ short ushort
+ int uint
+ long ulong
+ longlong ulonglong
+ float double
+ void* bool
}
+SYMBOLS:
+ ptrdiff_t intptr_t size_t
+ char* uchar* ;
+
[
<c-type>
c-ptr >>class
[ >c-ptr ] >>unboxer-quot
"box_alien" >>boxer
"alien_offset" >>unboxer
- "void*" define-primitive-type
+ \ void* define-primitive-type
<long-long-type>
integer >>class
8 >>align
"box_signed_8" >>boxer
"to_signed_8" >>unboxer
- "longlong" define-primitive-type
+ \ longlong define-primitive-type
<long-long-type>
integer >>class
8 >>align
"box_unsigned_8" >>boxer
"to_unsigned_8" >>unboxer
- "ulonglong" define-primitive-type
+ \ ulonglong define-primitive-type
<c-type>
integer >>class
bootstrap-cell >>align
"box_signed_cell" >>boxer
"to_fixnum" >>unboxer
- "long" define-primitive-type
+ \ long define-primitive-type
<c-type>
integer >>class
bootstrap-cell >>align
"box_unsigned_cell" >>boxer
"to_cell" >>unboxer
- "ulong" define-primitive-type
+ \ ulong define-primitive-type
<c-type>
integer >>class
4 >>align
"box_signed_4" >>boxer
"to_fixnum" >>unboxer
- "int" define-primitive-type
+ \ int define-primitive-type
<c-type>
integer >>class
4 >>align
"box_unsigned_4" >>boxer
"to_cell" >>unboxer
- "uint" define-primitive-type
+ \ uint define-primitive-type
<c-type>
fixnum >>class
2 >>align
"box_signed_2" >>boxer
"to_fixnum" >>unboxer
- "short" define-primitive-type
+ \ short define-primitive-type
<c-type>
fixnum >>class
2 >>align
"box_unsigned_2" >>boxer
"to_cell" >>unboxer
- "ushort" define-primitive-type
+ \ ushort define-primitive-type
<c-type>
fixnum >>class
1 >>align
"box_signed_1" >>boxer
"to_fixnum" >>unboxer
- "char" define-primitive-type
+ \ char define-primitive-type
<c-type>
fixnum >>class
1 >>align
"box_unsigned_1" >>boxer
"to_cell" >>unboxer
- "uchar" define-primitive-type
+ \ uchar define-primitive-type
<c-type>
[ alien-unsigned-1 c-bool> ] >>getter
1 >>align
"box_boolean" >>boxer
"to_boolean" >>unboxer
- "bool" define-primitive-type
+ \ bool define-primitive-type
<c-type>
- float >>class
- float >>boxed-class
+ math:float >>class
+ math:float >>boxed-class
[ alien-float ] >>getter
[ [ >float ] 2dip set-alien-float ] >>setter
4 >>size
"to_float" >>unboxer
float-rep >>rep
[ >float ] >>unboxer-quot
- "float" define-primitive-type
+ \ float define-primitive-type
<c-type>
- float >>class
- float >>boxed-class
+ math:float >>class
+ math:float >>boxed-class
[ alien-double ] >>getter
[ [ >float ] 2dip set-alien-double ] >>setter
8 >>size
"to_double" >>unboxer
double-rep >>rep
[ >float ] >>unboxer-quot
- "double" define-primitive-type
+ \ double define-primitive-type
- "long" "ptrdiff_t" typedef
- "long" "intptr_t" typedef
- "ulong" "size_t" typedef
+ \ long \ ptrdiff_t typedef
+ \ long \ intptr_t typedef
+ \ ulong \ size_t typedef
] with-compilation-unit
! (c) 2009 Joe Groff, see BSD license
-USING: accessors alien alien.c-types alien.complex alien.parser
+USING: accessors alien alien.c-types alien.complex grouping
alien.strings alien.syntax arrays ascii assocs
byte-arrays combinators combinators.short-circuit fry generalizations
kernel lexer macros math math.parser namespaces parser sequences
MACRO: fortran-invoke ( return library function parameters -- )
{ [ 2drop nip set-fortran-abi ] [ (fortran-invoke) ] } 4 ncleave ;
+: parse-arglist ( parameters return -- types effect )
+ [ 2 group unzip [ "," ?tail drop ] map ]
+ [ [ { } ] [ 1array ] if-void ]
+ bi* <effect> ;
+
:: define-fortran-function ( return library function parameters -- )
function create-in dup reset-generic
return library function parameters return [ "void" ] unless* parse-arglist
! Copyright (C) 2008, 2009 Slava Pestov, Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.c-types arrays assocs effects grouping kernel
-parser sequences splitting words fry locals lexer namespaces
-summary math ;
+USING: accessors alien alien.c-types arrays assocs
+combinators combinators.short-circuit effects grouping
+kernel parser sequences splitting words fry locals lexer
+namespaces summary math vocabs.parser ;
IN: alien.parser
+: parse-c-type-name ( name -- word/string )
+ [ search ] keep or ;
+
+: parse-c-type ( string -- array )
+ {
+ { [ dup "void" = ] [ drop void ] }
+ { [ CHAR: ] over member? ] [ parse-array-type parse-c-type-name prefix ] }
+ { [ dup search c-type-word? ] [ parse-c-type-name ] }
+ { [ dup c-types get at ] [ ] }
+ { [ "*" ?tail ] [ parse-c-type-name resolve-pointer-type ] }
+ [ no-c-type ]
+ } cond ;
+
+: scan-c-type ( -- c-type )
+ scan dup "{" =
+ [ drop \ } parse-until >array ]
+ [ parse-c-type ] if ;
+
+: reset-c-type ( word -- )
+ { "c-type" "pointer-c-type" } reset-props ;
+
+: CREATE-C-TYPE ( -- word )
+ scan current-vocab create dup reset-c-type ;
+
: normalize-c-arg ( type name -- type' name' )
[ length ]
[
[ CHAR: * = ] trim-head
[ length - CHAR: * <array> append ] keep
- ] bi ;
+ ] bi
+ [ parse-c-type ] dip ;
: parse-arglist ( parameters return -- types effect )
[
: define-function ( return library function parameters -- )
make-function define-declared ;
+
+PREDICATE: alien-function-word < word
+ def>> {
+ [ length 5 = ]
+ [ last \ alien-invoke eq? ]
+ } 1&& ;
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: kernel combinators alien alien.strings alien.syntax
-math.parser prettyprint.backend prettyprint.custom
-prettyprint.sections ;
+USING: accessors kernel combinators alien alien.strings alien.c-types
+alien.parser alien.syntax arrays assocs effects math.parser
+prettyprint.backend prettyprint.custom prettyprint.sections
+definitions see see.private sequences strings words ;
IN: alien.prettyprint
M: alien pprint*
} cond ;
M: dll pprint* dll-path dup "DLL\" " "\"" pprint-string ;
+
+M: c-type-word definer drop \ C-TYPE: f ;
+M: c-type-word definition drop f ;
+M: typedef-word declarations. drop ;
+
+GENERIC: pprint-c-type ( c-type -- )
+M: word pprint-c-type pprint-word ;
+M: wrapper pprint-c-type wrapped>> pprint-word ;
+M: string pprint-c-type text ;
+M: array pprint-c-type pprint* ;
+
+M: typedef-word definer drop \ TYPEDEF: f ;
+
+M: typedef-word synopsis*
+ \ TYPEDEF: pprint-word
+ dup "c-type" word-prop pprint-c-type
+ pprint-word ;
+
+: pprint-function-arg ( type name -- )
+ [ pprint-c-type ] [ text ] bi* ;
+
+: pprint-function-args ( word -- )
+ [ def>> fourth ] [ stack-effect in>> ] bi zip [ ] [
+ unclip-last
+ [ [ first2 "," append pprint-function-arg ] each ] dip
+ first2 pprint-function-arg
+ ] if-empty ;
+
+M: alien-function-word definer
+ drop \ FUNCTION: \ ; ;
+M: alien-function-word definition drop f ;
+M: alien-function-word synopsis*
+ \ FUNCTION: pprint-word
+ [ def>> first pprint-c-type ]
+ [ pprint-word ]
+ [ <block "(" text pprint-function-args ")" text block> ] tri ;
M: struct-type c-type-stack-align? drop f ;
: if-value-struct ( ctype true false -- )
- [ dup value-struct? ] 2dip '[ drop "void*" @ ] if ; inline
+ [ dup value-struct? ] 2dip '[ drop void* @ ] if ; inline
M: struct-type unbox-parameter
[ %unbox-large-struct ] [ unbox-parameter ] if-value-struct ;
(FUNCTION:) define-declared ;
SYNTAX: TYPEDEF:
- scan scan typedef ;
+ scan-c-type CREATE-C-TYPE typedef ;
SYNTAX: C-STRUCT:
scan current-vocab parse-definition define-struct ; deprecated
";" parse-tokens
[ [ create-in ] dip define-constant ] each-index ;
+SYNTAX: C-TYPE:
+ "Primitive C type definition not supported" throw ;
+
ERROR: no-such-symbol name library ;
: address-of ( name library -- value )
! (c)Joe Groff bsd license
-USING: accessors alien alien.c-types arrays assocs classes
-classes.struct combinators combinators.short-circuit continuations
-fry kernel libc make math math.parser mirrors prettyprint.backend
-prettyprint.custom prettyprint.sections see.private sequences
-slots strings summary words ;
+USING: accessors alien alien.c-types alien.prettyprint arrays
+assocs classes classes.struct combinators combinators.short-circuit
+continuations fry kernel libc make math math.parser mirrors
+prettyprint.backend prettyprint.custom prettyprint.sections
+see.private sequences slots strings summary words ;
IN: classes.struct.prettyprint
<PRIVATE
<flow \ { pprint-word
f <inset {
[ name>> text ]
- [ type>> dup string? [ text ] [ pprint* ] if ]
+ [ type>> pprint-c-type ]
[ read-only>> [ \ read-only pprint-word ] when ]
[ initial>> [ \ initial: pprint-word pprint* ] when* ]
} cleave block>
literals math mirrors multiline namespaces prettyprint
prettyprint.config see sequences specialized-arrays system
tools.test parser lexer eval layouts ;
+FROM: math => float ;
+QUALIFIED-WITH: alien.c-types c
SPECIALIZED-ARRAY: char
SPECIALIZED-ARRAY: int
SPECIALIZED-ARRAY: ushort
[ {
{ "underlying" B{ 98 0 0 98 127 0 0 127 0 0 0 0 } }
- { { "x" "char" } 98 }
- { { "y" "int" } HEX: 7F00007F }
- { { "z" "bool" } f }
+ { { "x" char } 98 }
+ { { "y" int } HEX: 7F00007F }
+ { { "z" bool } f }
} ] [
B{ 98 0 0 98 127 0 0 127 0 0 0 0 } struct-test-foo memory>struct
make-mirror >alist
] unit-test
UNION-STRUCT: struct-test-float-and-bits
- { f float }
+ { f c:float }
{ bits uint } ;
[ 1.0 ] [ struct-test-float-and-bits <struct> 1.0 float>bits >>bits f>> ] unit-test
] with-scope
] unit-test
-[ <" USING: classes.struct ;
+[ <" USING: alien.c-types classes.struct ;
IN: classes.struct.tests
STRUCT: struct-test-foo
{ x char initial: 0 } { y int initial: 123 } { z bool } ;
"> ]
[ [ struct-test-foo see ] with-string-writer ] unit-test
-[ <" USING: classes.struct ;
+[ <" USING: alien.c-types classes.struct ;
IN: classes.struct.tests
UNION-STRUCT: struct-test-float-and-bits
{ f float initial: 0.0 } { bits uint initial: 0 } ;
{ offset 0 }
{ initial 0 }
{ class fixnum }
- { type "char" }
+ { type char }
}
T{ struct-slot-spec
{ name "y" }
{ offset 4 }
{ initial 123 }
{ class integer }
- { type "int" }
+ { type int }
}
T{ struct-slot-spec
{ name "z" }
{ offset 8 }
{ initial f }
- { type "bool" }
+ { type bool }
{ class object }
}
} ] [ "struct-test-foo" c-type fields>> ] unit-test
T{ struct-slot-spec
{ name "f" }
{ offset 0 }
- { type "float" }
+ { type c:float }
{ class float }
{ initial 0.0 }
}
T{ struct-slot-spec
{ name "bits" }
{ offset 0 }
- { type "uint" }
+ { type uint }
{ class integer }
{ initial 0 }
}
] unit-test
STRUCT: struct-test-optimization
- { x { "int" 3 } } { y int } ;
+ { x { int 3 } } { y int } ;
SPECIALIZED-ARRAY: struct-test-optimization
! (c)Joe Groff bsd license
-USING: accessors alien alien.c-types arrays byte-arrays classes
-classes.parser classes.tuple classes.tuple.parser
+USING: accessors alien alien.c-types alien.parser arrays
+byte-arrays classes classes.parser classes.tuple classes.tuple.parser
classes.tuple.private combinators combinators.short-circuit
combinators.smart cpu.architecture definitions functors.backend
fry generalizations generic.parser kernel kernel.private lexer
libc locals macros make math math.order parser quotations
sequences slots slots.private specialized-arrays vectors words
-summary namespaces assocs ;
+summary namespaces assocs vocabs.parser ;
IN: classes.struct
SPECIALIZED-ARRAY: uchar
M: struct-c-type c-type-stack-align? drop f ;
: if-value-struct ( ctype true false -- )
- [ dup value-struct? ] 2dip '[ drop "void*" @ ] if ; inline
+ [ dup value-struct? ] 2dip '[ drop void* @ ] if ; inline
M: struct-c-type unbox-parameter
[ %unbox-large-struct ] [ unbox-parameter ] if-value-struct ;
[ type>> c-type-align ] [ max ] map-reduce ;
PRIVATE>
-M: struct-class c-type name>> c-type ;
-
-M: struct-class c-type-align c-type c-type-align ;
-
-M: struct-class c-type-getter c-type c-type-getter ;
-
-M: struct-class c-type-setter c-type c-type-setter ;
-
-M: struct-class c-type-boxer-quot c-type c-type-boxer-quot ;
-
-M: struct-class c-type-unboxer-quot c-type c-type-boxer-quot ;
-
-M: struct-class heap-size c-type heap-size ;
-
M: struct byte-length class "struct-size" word-prop ; foldable
! class definition
[ check-struct-slots ] _ [ struct-align [ align ] keep ] tri
(struct-word-props)
]
- [ drop [ c-type-for-class ] [ name>> ] bi typedef ] 2tri ; inline
+ [ drop [ c-type-for-class ] keep typedef ] 2tri ; inline
PRIVATE>
: define-struct-class ( class slots -- )
[ [ dup empty? ] [ peel-off-attributes ] until drop ] tri* ;
<PRIVATE
-: scan-c-type ( -- c-type )
- scan dup "{" = [ drop \ } parse-until >array ] when ;
-
: parse-struct-slot ( -- slot )
scan scan-c-type \ } parse-until <struct-slot-spec> ;
<PRIVATE
: scan-c-type` ( -- c-type/param )
- scan dup "{" = [ drop \ } parse-until >array ] [ >string-param ] if ;
+ scan dup "{" = [ drop \ } parse-until >array ] [ search ] if ;
: parse-struct-slot` ( accum -- accum )
scan-string-param scan-c-type` \ } parse-until
: callback-return-quot ( ctype -- quot )
return>> {
- { [ dup "void" = ] [ drop [ ] ] }
+ { [ dup void? ] [ drop [ ] ] }
{ [ dup large-struct? ] [ heap-size '[ _ memcpy ] ] }
[ c-type c-type-unboxer-quot ]
} cond ;
namespaces.private parser quotations sequences
specialized-arrays stack-checker stack-checker.errors
system threads tools.test words ;
+FROM: alien.c-types => float short ;
SPECIALIZED-ARRAY: float
SPECIALIZED-ARRAY: char
IN: compiler.tests.alien
alien.accessors layouts words definitions compiler.units io
combinators vectors grouping make alien.c-types combinators.short-circuit
math.order math.libm math.parser ;
+FROM: math => float ;
QUALIFIED: namespaces.private
IN: compiler.tests.codegen
[ "0.169967142900241" "0.9854497299884601" ] [ 1.4 [ [ fcos ] [ fsin ] bi ] compile-call [ number>string ] bi@ ] unit-test
[ 1 "0.169967142900241" "0.9854497299884601" ] [ 1.4 1 [ swap >float [ fcos ] [ fsin ] bi ] compile-call [ number>string ] bi@ ] unit-test
-[ 6.0 ] [ 1.0 [ >float 3.0 + [ B{ 0 0 0 0 } 0 set-alien-float ] [ 2.0 + ] bi ] compile-call ] unit-test
\ No newline at end of file
+[ 6.0 ] [ 1.0 [ >float 3.0 + [ B{ 0 0 0 0 } 0 set-alien-float ] [ 2.0 + ] bi ] compile-call ] unit-test
sbufs strings.private slots.private alien math.order
alien.accessors alien.c-types alien.syntax alien.strings
namespaces libc io.encodings.ascii classes compiler ;
+FROM: math => float ;
IN: compiler.tests.intrinsics
! Make sure that intrinsic ops compile to correct code.
compiler.tree.propagation.info
compiler.tree.checker
compiler.tree.debugger ;
+FROM: math => float ;
IN: compiler.tree.cleanup.tests
[ t ] [ [ [ 1 ] [ 2 ] if ] cleaned-up-tree [ #if? ] contains-node? ] unit-test
slots.private words hashtables classes assocs locals
specialized-arrays system sorting math.libm
math.intervals quotations effects alien ;
+FROM: math => float ;
SPECIALIZED-ARRAY: double
IN: compiler.tree.propagation.tests
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types alien.syntax kernel math core-foundation ;
+FROM: math => float ;
IN: core-foundation.numbers
TYPEDEF: void* CFNumberRef
4 >>align
"box_boolean" >>boxer
"to_boolean" >>unboxer
- "bool" define-primitive-type
+ bool define-primitive-type
] with-compilation-unit
M: x86.64 reserved-area-size 0 ;
-! The ABI for passing structs by value is pretty messed up
-<< "void*" c-type clone "__stack_value" define-primitive-type
-stack-params "__stack_value" c-type (>>rep) >>
+SYMBOL: (stack-value)
+! The ABI for passing structs by value is pretty great
+<< void* c-type clone \ (stack-value) define-primitive-type
+stack-params \ (stack-value) c-type (>>rep) >>
: struct-types&offset ( struct-type -- pairs )
fields>> [
: flatten-small-struct ( c-type -- seq )
struct-types&offset split-struct [
[ c-type c-type-rep reg-class-of ] map
- int-regs swap member? "void*" "double" ? c-type
+ int-regs swap member? void* double ? c-type
] map ;
: flatten-large-struct ( c-type -- seq )
heap-size cell align
- cell /i "__stack_value" c-type <repetition> ;
+ cell /i \ (stack-value) c-type <repetition> ;
: flatten-struct ( c-type -- seq )
dup heap-size 16 > [
M: x86.64 temp-reg RAX ;
<<
-"longlong" "ptrdiff_t" typedef
-"longlong" "intptr_t" typedef
-"int" c-type "long" define-primitive-type
-"uint" c-type "ulong" define-primitive-type
+longlong ptrdiff_t typedef
+longlong intptr_t typedef
+int c-type long define-primitive-type
+uint c-type ulong define-primitive-type
>>
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: system kernel math math.order math.parser namespaces
-alien.syntax combinators locals init io cpu.x86 compiler
-compiler.units accessors ;
+alien.c-types alien.syntax combinators locals init io cpu.x86
+compiler compiler.units accessors ;
IN: cpu.x86.features
<PRIVATE
compiler.cfg.stack-frame
compiler.codegen
compiler.codegen.fixup ;
+FROM: math => float ;
IN: cpu.x86
<< enable-fixnum-log2 >>
USING: classes.struct functors tools.test math words kernel
multiline parser io.streams.string generic ;
+QUALIFIED-WITH: alien.c-types c
IN: functors.tests
<<
WHERE
STRUCT: T-class
- { NAME int }
+ { NAME c:int }
{ x { TYPE 4 } }
- { y { "short" N } }
+ { y { c:short N } }
{ z TYPE initial: 5 }
- { float { "float" 2 } } ;
+ { float { c:float 2 } } ;
;FUNCTOR
-"a-struct" "nemo" "char" 2 define-a-struct
+"a-struct" "nemo" c:char 2 define-a-struct
>>
{ offset 0 }
{ class integer }
{ initial 0 }
- { type "int" }
+ { type c:int }
}
T{ struct-slot-spec
{ name "x" }
{ offset 4 }
{ class object }
{ initial f }
- { type { "char" 4 } }
+ { type { c:char 4 } }
}
T{ struct-slot-spec
{ name "y" }
{ offset 8 }
{ class object }
{ initial f }
- { type { "short" 2 } }
+ { type { c:short 2 } }
}
T{ struct-slot-spec
{ name "z" }
{ offset 12 }
{ class fixnum }
{ initial 5 }
- { type "char" }
+ { type c:char }
}
T{ struct-slot-spec
{ name "float" }
{ offset 16 }
{ class object }
{ initial f }
- { type { "float" 2 } }
+ { type { c:float 2 } }
}
}
] [ a-struct struct-slots ] unit-test
[ device-attached? not ] filter
[ remove-controller ] each ;
-: device-interface? ( dbt-broadcast-hdr -- ? )
- dbch_devicetype>> DBT_DEVTYP_DEVICEINTERFACE = ;
+: ?device-interface ( dbt-broadcast-hdr -- ? )
+ dup dbch_devicetype>> DBT_DEVTYP_DEVICEINTERFACE =
+ [ >c-ptr DEV_BROADCAST_DEVICEW memory>struct ]
+ [ drop f ] if ; inline
: device-arrived ( dbt-broadcast-hdr -- )
- device-interface? [ find-controllers ] when ;
+ ?device-interface [ find-controllers ] when ; inline
: device-removed ( dbt-broadcast-hdr -- )
- device-interface? [ find-and-remove-detached-devices ] when ;
+ ?device-interface [ find-and-remove-detached-devices ] when ; inline
+
+: <DEV_BROADCAST_HDR> ( wParam -- struct )
+ <alien> DEV_BROADCAST_HDR memory>struct ;
: handle-wm-devicechange ( hWnd uMsg wParam lParam -- )
[ 2drop ] 2dip swap {
- { [ dup DBT_DEVICEARRIVAL = ] [ drop <alien> device-arrived ] }
- { [ dup DBT_DEVICEREMOVECOMPLETE = ] [ drop <alien> device-removed ] }
+ { [ dup DBT_DEVICEARRIVAL = ] [ drop <DEV_BROADCAST_HDR> device-arrived ] }
+ { [ dup DBT_DEVICEREMOVECOMPLETE = ] [ drop <DEV_BROADCAST_HDR> device-removed ] }
[ 2drop ]
} cond ;
sequences sequences.merged sequences.private shuffle
parser prettyprint.backend prettyprint.custom ascii
specialized-arrays ;
+FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float
SPECIALIZED-ARRAY: double
SPECIALIZED-ARRAY: complex-float
math.complex math.functions math.order sequences sequences.private
functors words locals parser prettyprint.backend prettyprint.custom
specialized-arrays ;
+FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float
SPECIALIZED-ARRAY: double
SPECIALIZED-ARRAY: complex-float
! Copyright (C) 2006 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: alien ;
+USING: alien alien.c-types ;
IN: math.libm
: facos ( x -- y )
- "double" "libm" "acos" { "double" } alien-invoke ;
+ double "libm" "acos" { double } alien-invoke ;
: fasin ( x -- y )
- "double" "libm" "asin" { "double" } alien-invoke ;
+ double "libm" "asin" { double } alien-invoke ;
: fatan ( x -- y )
- "double" "libm" "atan" { "double" } alien-invoke ;
+ double "libm" "atan" { double } alien-invoke ;
: fatan2 ( x y -- z )
- "double" "libm" "atan2" { "double" "double" } alien-invoke ;
+ double "libm" "atan2" { double double } alien-invoke ;
: fcos ( x -- y )
- "double" "libm" "cos" { "double" } alien-invoke ;
+ double "libm" "cos" { double } alien-invoke ;
: fsin ( x -- y )
- "double" "libm" "sin" { "double" } alien-invoke ;
+ double "libm" "sin" { double } alien-invoke ;
: ftan ( x -- y )
- "double" "libm" "tan" { "double" } alien-invoke ;
+ double "libm" "tan" { double } alien-invoke ;
: fcosh ( x -- y )
- "double" "libm" "cosh" { "double" } alien-invoke ;
+ double "libm" "cosh" { double } alien-invoke ;
: fsinh ( x -- y )
- "double" "libm" "sinh" { "double" } alien-invoke ;
+ double "libm" "sinh" { double } alien-invoke ;
: ftanh ( x -- y )
- "double" "libm" "tanh" { "double" } alien-invoke ;
+ double "libm" "tanh" { double } alien-invoke ;
: fexp ( x -- y )
- "double" "libm" "exp" { "double" } alien-invoke ;
+ double "libm" "exp" { double } alien-invoke ;
: flog ( x -- y )
- "double" "libm" "log" { "double" } alien-invoke ;
+ double "libm" "log" { double } alien-invoke ;
: flog10 ( x -- y )
- "double" "libm" "log10" { "double" } alien-invoke ;
+ double "libm" "log10" { double } alien-invoke ;
: fpow ( x y -- z )
- "double" "libm" "pow" { "double" "double" } alien-invoke ;
+ double "libm" "pow" { double double } alien-invoke ;
: fsqrt ( x -- y )
- "double" "libm" "sqrt" { "double" } alien-invoke ;
+ double "libm" "sqrt" { double } alien-invoke ;
! Windows doesn't have these...
: flog1+ ( x -- y )
- "double" "libm" "log1p" { "double" } alien-invoke ;
+ double "libm" "log1p" { double } alien-invoke ;
: facosh ( x -- y )
- "double" "libm" "acosh" { "double" } alien-invoke ;
+ double "libm" "acosh" { double } alien-invoke ;
: fasinh ( x -- y )
- "double" "libm" "asinh" { "double" } alien-invoke ;
+ double "libm" "asinh" { double } alien-invoke ;
: fatanh ( x -- y )
- "double" "libm" "atanh" { "double" } alien-invoke ;
+ double "libm" "atanh" { double } alien-invoke ;
FUNCTOR: define-simd-128 ( T -- )
-N [ 16 T heap-size /i ]
+T-TYPE IS ${T}
+
+N [ 16 T-TYPE heap-size /i ]
A DEFINES-CLASS ${T}-${N}
>A DEFINES >${A}
A{ DEFINES ${A}{
-NTH [ T dup c-type-getter-boxer array-accessor ]
-SET-NTH [ T dup c-setter array-accessor ]
+NTH [ T-TYPE dup c-type-getter-boxer array-accessor ]
+SET-NTH [ T-TYPE dup c-setter array-accessor ]
A-rep IS ${A}-rep
A-vv->v-op DEFINES-PRIVATE ${A}-vv->v-op
! Synthesize 256-bit vectors from a pair of 128-bit vectors
FUNCTOR: define-simd-256 ( T -- )
-N [ 32 T heap-size /i ]
+T-TYPE IS ${T}
+
+N [ 32 T-TYPE heap-size /i ]
N/2 [ N 2 / ]
A/2 IS ${T}-${N/2}
math.vectors.simd.functor math.vectors.simd.intrinsics
math.vectors.specialization parser prettyprint.custom sequences
sequences.private locals assocs words fry ;
+FROM: alien.c-types => float ;
+QUALIFIED-WITH: math m
IN: math.vectors.simd
<<
DEFER: double-4
"double" define-simd-128
-"float" define-simd-128
+"float" define-simd-128
"double" define-simd-256
-"float" define-simd-256
+"float" define-simd-256
>>
PRIVATE>
-\ float-4 \ float-4-with float H{
+\ float-4 \ float-4-with m:float H{
{ v+ [ [ (simd-v+) ] float-4-vv->v-op ] }
{ v- [ [ (simd-v-) ] float-4-vv->v-op ] }
{ v* [ [ (simd-v*) ] float-4-vv->v-op ] }
{ sum [ [ (simd-sum) ] float-4-v->n-op ] }
} simd-vector-words
-\ double-2 \ double-2-with float H{
+\ double-2 \ double-2-with m:float H{
{ v+ [ [ (simd-v+) ] double-2-vv->v-op ] }
{ v- [ [ (simd-v-) ] double-2-vv->v-op ] }
{ v* [ [ (simd-v*) ] double-2-vv->v-op ] }
{ sum [ [ (simd-sum) ] double-2-v->n-op ] }
} simd-vector-words
-\ float-8 \ float-8-with float H{
+\ float-8 \ float-8-with m:float H{
{ v+ [ [ (simd-v+) ] float-8-vv->v-op ] }
{ v- [ [ (simd-v-) ] float-8-vv->v-op ] }
{ v* [ [ (simd-v*) ] float-8-vv->v-op ] }
{ sum [ [ (simd-sum) ] [ + ] float-8-v->n-op ] }
} simd-vector-words
-\ double-4 \ double-4-with float H{
+\ double-4 \ double-4-with m:float H{
{ v+ [ [ (simd-v+) ] double-4-vv->v-op ] }
{ v- [ [ (simd-v-) ] double-4-vv->v-op ] }
{ v* [ [ (simd-v*) ] double-4-vv->v-op ] }
sequences splitting words byte-arrays assocs vocabs
colors colors.constants accessors generalizations locals fry
specialized-arrays ;
+FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float
SPECIALIZED-ARRAY: uint
IN: opengl
combinators.smart compiler.tree.debugger math libc destructors
sequences.private multiline eval words vocabs namespaces
assocs prettyprint ;
+FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: int
SPECIALIZED-ARRAY: bool
! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien alien.c-types assocs byte-arrays classes
-compiler.units functors kernel lexer libc math
+USING: accessors alien alien.c-types alien.parser assocs
+byte-arrays classes compiler.units functors kernel lexer libc math
math.vectors.specialization namespaces parser prettyprint.custom
sequences sequences.private strings summary vocabs vocabs.loader
vocabs.parser words fry combinators ;
;FUNCTOR
+GENERIC: (underlying-type) ( c-type -- c-type' )
+
+M: string (underlying-type) c-types get at ;
+M: word (underlying-type) "c-type" word-prop ;
+
: underlying-type ( c-type -- c-type' )
- dup c-types get at {
+ dup (underlying-type) {
{ [ dup not ] [ drop no-c-type ] }
- { [ dup string? ] [ nip underlying-type ] }
+ { [ dup c-type-name? ] [ nip underlying-type ] }
[ drop ]
} cond ;
+: underlying-type-name ( c-type -- name )
+ underlying-type dup word? [ name>> ] when ;
+
: specialized-array-vocab ( c-type -- vocab )
"specialized-arrays.instances." prepend ;
] ?if ; inline
: define-array-vocab ( type -- vocab )
- underlying-type
+ underlying-type-name
[ specialized-array-vocab ] [ '[ _ define-array ] ] bi
generate-vocab ;
-M: string require-c-array define-array-vocab drop ;
+M: c-type-name require-c-array define-array-vocab drop ;
ERROR: specialized-array-vocab-not-loaded c-type ;
-M: string c-array-constructor
- underlying-type
+M: c-type-name c-array-constructor
+ underlying-type-name
dup [ "<" "-array>" surround ] [ specialized-array-vocab ] bi lookup
[ ] [ specialized-array-vocab-not-loaded ] ?if ; foldable
-M: string c-(array)-constructor
- underlying-type
+M: c-type-name c-(array)-constructor
+ underlying-type-name
dup [ "(" "-array)" surround ] [ specialized-array-vocab ] bi lookup
[ ] [ specialized-array-vocab-not-loaded ] ?if ; foldable
-M: string c-direct-array-constructor
- underlying-type
+M: c-type-name c-direct-array-constructor
+ underlying-type-name
dup [ "<direct-" "-array>" surround ] [ specialized-array-vocab ] bi lookup
[ ] [ specialized-array-vocab-not-loaded ] ?if ; foldable
SYNTAX: SPECIALIZED-ARRAY:
- scan define-array-vocab use-vocab ;
+ scan-c-type define-array-vocab use-vocab ;
"prettyprint" vocab [
"specialized-arrays.prettyprint" require
: alien-stack ( params extra -- )
over parameters>> length + consume-d >>in-d
- dup return>> "void" = 0 1 ? produce-d >>out-d
+ dup return>> void? 0 1 ? produce-d >>out-d
drop ;
: return-prep-quot ( node -- quot )
: (stack-effect-from-return-and-parameters) ( return parameters -- stack-effect )
swap
[ [ second ] map ]
- [ dup "void" = [ drop { } ] [ 1array ] if ] bi*
+ [ dup void? [ drop { } ] [ 1array ] if ] bi*
<effect> ;
: (define-word-for-function) ( function interface n -- )
windows.com.syntax alien alien.c-types alien.syntax kernel system namespaces
combinators sequences fry math accessors macros words quotations
libc continuations generalizations splitting locals assocs init
-specialized-arrays memoize classes.struct ;
+specialized-arrays memoize classes.struct strings arrays ;
SPECIALIZED-ARRAY: DIOBJECTDATAFORMAT
IN: windows.dinput.constants
MEMO: c-type* ( name -- c-type ) c-type ;
MEMO: heap-size* ( c-type -- n ) heap-size ;
+GENERIC: array-base-type ( c-type -- c-type' )
+M: object array-base-type ;
+M: string array-base-type "[" split1 drop ;
+M: array array-base-type first ;
+
: (field-spec-of) ( field struct -- field-spec )
c-type* fields>> [ name>> = ] with find nip ;
: (offsetof) ( field struct -- offset )
[ (field-spec-of) offset>> ] [ drop 0 ] if* ;
: (sizeof) ( field struct -- size )
- [ (field-spec-of) type>> "[" split1 drop heap-size* ] [ drop 1 ] if* ;
+ [ (field-spec-of) type>> array-base-type heap-size* ] [ drop 1 ] if* ;
: (flag) ( thing -- integer )
{
USING: alien alien.c-types alien.syntax namespaces kernel words
sequences math math.bitwise math.vectors colors
io.encodings.utf16n classes.struct accessors ;
+FROM: alien.c-types => float short ;
IN: windows.types
TYPEDEF: char CHAR
TYPEDEF: LARGE_INTEGER* PLARGE_INTEGER
TYPEDEF: ULARGE_INTEGER* PULARGE_INTEGER
-<< { "char*" utf16n } "wchar_t*" typedef >>
+SYMBOL: wchar_t*
+<< { char* utf16n } \ wchar_t* typedef >>
TYPEDEF: wchar_t* LPCSTR
TYPEDEF: wchar_t* LPWSTR
byte-arrays kernel literals math sequences windows.types
windows.kernel32 windows.errors math.bitwise io.encodings.utf16n
classes.struct windows.com.syntax init ;
+FROM: alien.c-types => short ;
IN: windows.winsock
TYPEDEF: void* SOCKET
USING: accessors kernel arrays alien alien.c-types alien.strings
alien.syntax classes.struct math math.bitwise words sequences
namespaces continuations io io.encodings.ascii x11.syntax ;
+FROM: alien.c-types => short ;
IN: x11.xlib
LIBRARY: xlib
[ current-vocab name>> % "_" % % ] "" make ;
PRIVATE>
+: parse-arglist ( parameters return -- types effect )
+ [ 2 group unzip [ "," ?tail drop ] map ]
+ [ [ { } ] [ 1array ] if-void ]
+ bi* <effect> ;
+
: append-function-body ( prototype-str body -- str )
[ swap % " {\n" % % "\n}\n" % ] "" make ;
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types assocs combinators.short-circuit
continuations effects fry kernel math memoize sequences
-splitting strings peg.ebnf make ;
+splitting strings peg.ebnf make words ;
IN: alien.inline.types
: cify-type ( str -- str' )
+ dup word? [ name>> ] when
{ { CHAR: - CHAR: space } } substitute ;
: factorize-type ( str -- str' )
io.encodings.utf8 kernel libc sequences
specialized-arrays strings unix.utilities vocabs.parser
words libc.private locals generalizations math ;
+FROM: alien.c-types => float short ;
SPECIALIZED-ARRAY: bool
SPECIALIZED-ARRAY: char
SPECIALIZED-ARRAY: double
SPECIALIZED-ARRAY: void*
IN: alien.marshall
-<< primitive-types [ [ "void*" = ] [ "bool" = ] bi or not ]
+<< primitive-types [ [ void* = ] [ bool = ] bi or not ]
filter [ define-primitive-marshallers ] each >>
TUPLE: alien-wrapper { underlying alien } ;
math math.matrices math.parser math.vectors opengl
opengl.capabilities opengl.gl opengl.demo-support sequences
splitting vectors words specialized-arrays ;
-SPECIALIZED-ARRAY: float
-SPECIALIZED-ARRAY: uint
+QUALIFIED-WITH: alien.c-types c
+SPECIALIZED-ARRAY: c:float
+SPECIALIZED-ARRAY: c:uint
IN: bunny.model
: numbers ( str -- seq )
TYPEDEF: long FT_Long
TYPEDEF: ulong FT_ULong
TYPEDEF: uchar FT_Bool
-TYPEDEF: cell FT_Offset
+TYPEDEF: ulong FT_Offset
TYPEDEF: int FT_PtrDist
TYPEDEF: char FT_String
TYPEDEF: int FT_Tag
math.matrices math.parser math.vectors method-chains sequences
splitting threads ui ui.gadgets ui.gadgets.worlds
ui.pixel-formats specialized-arrays specialized-vectors ;
+FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float
SPECIALIZED-VECTOR: uint
IN: gpu.demos.bunny
opengl.gl parser quotations sequences slots sorting
specialized-arrays strings ui.gadgets.worlds variants
vocabs.parser words ;
-SPECIALIZED-ARRAY: float
+FROM: math => float ;
+QUALIFIED-WITH: alien.c-types c
+SPECIALIZED-ARRAY: c:float
SPECIALIZED-ARRAY: int
SPECIALIZED-ARRAY: uint
SPECIALIZED-ARRAY: void*
USING: accessors alien.c-types arrays byte-arrays combinators gpu
kernel literals math math.rectangles opengl opengl.gl sequences
variants specialized-arrays ;
+QUALIFIED-WITH: alien.c-types c
+FROM: math => float ;
SPECIALIZED-ARRAY: int
-SPECIALIZED-ARRAY: float
+SPECIALIZED-ARRAY: c:float
IN: gpu.state
UNION: ?rect rect POSTPONE: f ;
destructors fry gpu gpu.buffers images kernel locals math
opengl opengl.gl opengl.textures sequences
specialized-arrays ui.gadgets.worlds variants ;
+FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float
IN: gpu.textures
jamshred.player jamshred.tunnel kernel math math.constants
math.functions math.vectors opengl opengl.gl opengl.glu
opengl.demo-support sequences specialized-arrays ;
+FROM: alien.c-types => float ;
SPECIALIZED-ARRAY: float
IN: jamshred.gl
alien.syntax namespaces alien.c-types sequences vocabs.loader
shuffle openal.backend alien.libraries generalizations
specialized-arrays ;
+FROM: alien.c-types => float short ;
SPECIALIZED-ARRAY: uint
IN: openal
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types combinators kernel locals math
math.ranges openal sequences sequences.merged specialized-arrays ;
+FROM: alien.c-types => short ;
SPECIALIZED-ARRAY: uchar
SPECIALIZED-ARRAY: short
IN: synth.buffers