"cdecl" -> cdecl

release
Joe Groff 2010-03-31 19:20:35 -07:00
parent 565e3383ab
commit 65c3259761
56 changed files with 142 additions and 138 deletions

View File

@ -13,8 +13,8 @@ SINGLETONS: f2c-abi g95-abi gfortran-abi intel-unix-abi intel-windows-abi ;
<< <<
: add-f2c-libraries ( -- ) : add-f2c-libraries ( -- )
"I77" "libI77.so" "cdecl" add-library "I77" "libI77.so" cdecl add-library
"F77" "libF77.so" "cdecl" add-library ; "F77" "libF77.so" cdecl add-library ;
os netbsd? [ add-f2c-libraries ] when os netbsd? [ add-f2c-libraries ] when
>> >>
@ -42,11 +42,11 @@ library-fortran-abis [ H{ } clone ] initialize
[ "__" append ] [ "_" append ] if ; [ "__" append ] [ "_" append ] if ;
HOOK: fortran-c-abi fortran-abi ( -- abi ) HOOK: fortran-c-abi fortran-abi ( -- abi )
M: f2c-abi fortran-c-abi "cdecl" ; M: f2c-abi fortran-c-abi cdecl ;
M: g95-abi fortran-c-abi "cdecl" ; M: g95-abi fortran-c-abi cdecl ;
M: gfortran-abi fortran-c-abi "cdecl" ; M: gfortran-abi fortran-c-abi cdecl ;
M: intel-unix-abi fortran-c-abi "cdecl" ; M: intel-unix-abi fortran-c-abi cdecl ;
M: intel-windows-abi fortran-c-abi "cdecl" ; M: intel-windows-abi fortran-c-abi cdecl ;
HOOK: real-functions-return-double? fortran-abi ( -- ? ) HOOK: real-functions-return-double? fortran-abi ( -- ? )
M: f2c-abi real-functions-return-double? t ; M: f2c-abi real-functions-return-double? t ;

View File

@ -6,7 +6,7 @@ IN: alien.libraries
HELP: <library> HELP: <library>
{ $values { $values
{ "path" "a pathname string" } { "abi" "the ABI used by the library, either " { $snippet "cdecl" } " or " { $snippet "stdcall" } } { "path" "a pathname string" } { "abi" "the ABI used by the library, either " { $snippet cdecl } " or " { $snippet "stdcall" } }
{ "library" library } } { "library" library } }
{ $description "Opens a C library using the path and ABI parameters and outputs a library tuple." } { $description "Opens a C library using the path and ABI parameters and outputs a library tuple." }
{ $notes "User code should use " { $link add-library } " so that the opened library is added to a global hashtable, " { $link libraries } "." } ; { $notes "User code should use " { $link add-library } " so that the opened library is added to a global hashtable, " { $link libraries } "." } ;
@ -19,7 +19,7 @@ HELP: library
{ $description "Looks up a library by its logical name. The library object is a hashtable with the following keys:" { $description "Looks up a library by its logical name. The library object is a hashtable with the following keys:"
{ $list { $list
{ { $snippet "name" } " - the full path of the C library binary" } { { $snippet "name" } " - the full path of the C library binary" }
{ { $snippet "abi" } " - the ABI used by the library, either " { $snippet "cdecl" } " or " { $snippet "stdcall" } } { { $snippet "abi" } " - the ABI used by the library, either " { $snippet cdecl } " or " { $snippet "stdcall" } }
{ { $snippet "dll" } " - an instance of the " { $link dll } " class; only set if the library is loaded" } { { $snippet "dll" } " - an instance of the " { $link dll } " class; only set if the library is loaded" }
} }
} ; } ;

View File

@ -36,7 +36,7 @@ M: library dispose dll>> [ dispose ] when* ;
[ <library> swap libraries get set-at ] 3bi ; [ <library> swap libraries get set-at ] 3bi ;
: library-abi ( library -- abi ) : library-abi ( library -- abi )
library [ abi>> ] [ "cdecl" ] if* ; library [ abi>> ] [ cdecl ] if* ;
SYMBOL: deploy-libraries SYMBOL: deploy-libraries

View File

@ -6,14 +6,14 @@ eval ;
IN: alien.remote-control IN: alien.remote-control
: eval-callback ( -- callback ) : eval-callback ( -- callback )
void* { c-string } "cdecl" void* { c-string } cdecl
[ eval>string utf8 malloc-string ] alien-callback ; [ eval>string utf8 malloc-string ] alien-callback ;
: yield-callback ( -- callback ) : yield-callback ( -- callback )
void { } "cdecl" [ yield ] alien-callback ; void { } cdecl [ yield ] alien-callback ;
: sleep-callback ( -- callback ) : sleep-callback ( -- callback )
void { long } "cdecl" [ sleep ] alien-callback ; void { long } cdecl [ sleep ] alien-callback ;
: ?callback ( word -- alien ) : ?callback ( word -- alien )
dup optimized? [ execute ] [ drop f ] if ; inline dup optimized? [ execute ] [ drop f ] if ; inline

View File

@ -10,8 +10,8 @@ alien.libraries classes.struct ;
IN: cairo.ffi IN: cairo.ffi
<< { << {
{ [ os winnt? ] [ "cairo" "libcairo-2.dll" "cdecl" add-library ] } { [ os winnt? ] [ "cairo" "libcairo-2.dll" cdecl add-library ] }
{ [ os macosx? ] [ "cairo" "/opt/local/lib/libcairo.dylib" "cdecl" add-library ] } { [ os macosx? ] [ "cairo" "/opt/local/lib/libcairo.dylib" cdecl add-library ] }
{ [ os unix? ] [ ] } { [ os unix? ] [ ] }
} cond >> } cond >>
@ -38,7 +38,7 @@ TYPEDEF: void* cairo_pattern_t
TYPEDEF: void* cairo_destroy_func_t TYPEDEF: void* cairo_destroy_func_t
: cairo-destroy-func ( quot -- callback ) : cairo-destroy-func ( quot -- callback )
[ void { pointer: void } "cdecl" ] dip alien-callback ; inline [ void { pointer: void } cdecl ] dip alien-callback ; inline
! See cairo.h for details ! See cairo.h for details
STRUCT: cairo_user_data_key_t STRUCT: cairo_user_data_key_t
@ -79,11 +79,11 @@ CONSTANT: CAIRO_CONTENT_COLOR_ALPHA HEX: 3000
TYPEDEF: void* cairo_write_func_t TYPEDEF: void* cairo_write_func_t
: cairo-write-func ( quot -- callback ) : cairo-write-func ( quot -- callback )
[ cairo_status_t { pointer: void c-string int } "cdecl" ] dip alien-callback ; inline [ cairo_status_t { pointer: void c-string int } cdecl ] dip alien-callback ; inline
TYPEDEF: void* cairo_read_func_t TYPEDEF: void* cairo_read_func_t
: cairo-read-func ( quot -- callback ) : cairo-read-func ( quot -- callback )
[ cairo_status_t { pointer: void c-string int } "cdecl" ] dip alien-callback ; inline [ cairo_status_t { pointer: void c-string int } cdecl ] dip alien-callback ; inline
! Functions for manipulating state objects ! Functions for manipulating state objects
FUNCTION: cairo_t* FUNCTION: cairo_t*

View File

@ -40,7 +40,7 @@ IN: cocoa.subclassing
: prepare-method ( ret types quot -- type imp ) : prepare-method ( ret types quot -- type imp )
[ [ encode-types ] 2keep ] dip [ [ encode-types ] 2keep ] dip
'[ _ _ "cdecl" _ alien-callback ] '[ _ _ cdecl _ alien-callback ]
(( -- callback )) define-temp ; (( -- callback )) define-temp ;
: prepare-methods ( methods -- methods ) : prepare-methods ( methods -- methods )

View File

@ -68,8 +68,8 @@ IN: compiler.cfg.builder.tests
[ [ dup ] loop ] [ [ dup ] loop ]
[ [ 2 ] [ 3 throw ] if 4 ] [ [ 2 ] [ 3 throw ] if 4 ]
[ int f "malloc" { int } alien-invoke ] [ int f "malloc" { int } alien-invoke ]
[ int { int } "cdecl" alien-indirect ] [ int { int } cdecl alien-indirect ]
[ int { int } "cdecl" [ ] alien-callback ] [ int { int } cdecl [ ] alien-callback ]
[ swap - + * ] [ swap - + * ]
[ swap slot ] [ swap slot ]
[ blahblah ] [ blahblah ]

View File

@ -19,7 +19,7 @@ IN: compiler.tests.alien
{ [ os unix? ] [ "libfactor-ffi-test.so" ] } { [ os unix? ] [ "libfactor-ffi-test.so" ] }
} cond append-path ; } cond append-path ;
"f-cdecl" libfactor-ffi-tests-path "cdecl" add-library "f-cdecl" libfactor-ffi-tests-path cdecl add-library
"f-stdcall" libfactor-ffi-tests-path "stdcall" add-library "f-stdcall" libfactor-ffi-tests-path "stdcall" add-library
>> >>
@ -90,7 +90,7 @@ FUNCTION: TINY ffi_test_17 int x ;
[ [ alien-indirect ] infer ] [ inference-error? ] must-fail-with [ [ alien-indirect ] infer ] [ inference-error? ] must-fail-with
: indirect-test-1 ( ptr -- result ) : indirect-test-1 ( ptr -- result )
int { } "cdecl" alien-indirect ; int { } cdecl alien-indirect ;
{ 1 1 } [ indirect-test-1 ] must-infer-as { 1 1 } [ indirect-test-1 ] must-infer-as
@ -99,7 +99,7 @@ FUNCTION: TINY ffi_test_17 int x ;
[ 3 ] [ &: ffi_test_1 indirect-test-1 ] unit-test [ 3 ] [ &: ffi_test_1 indirect-test-1 ] unit-test
: indirect-test-1' ( ptr -- ) : indirect-test-1' ( ptr -- )
int { } "cdecl" alien-indirect drop ; int { } cdecl alien-indirect drop ;
{ 1 0 } [ indirect-test-1' ] must-infer-as { 1 0 } [ indirect-test-1' ] must-infer-as
@ -108,7 +108,7 @@ FUNCTION: TINY ffi_test_17 int x ;
[ -1 indirect-test-1 ] must-fail [ -1 indirect-test-1 ] must-fail
: indirect-test-2 ( x y ptr -- result ) : indirect-test-2 ( x y ptr -- result )
int { int int } "cdecl" alien-indirect gc ; int { int int } cdecl alien-indirect gc ;
{ 3 1 } [ indirect-test-2 ] must-infer-as { 3 1 } [ indirect-test-2 ] must-infer-as
@ -314,21 +314,21 @@ FUNCTION: ulonglong ffi_test_38 ( ulonglong x, ulonglong y ) ;
! Test callbacks ! Test callbacks
: callback-1 ( -- callback ) void { } "cdecl" [ ] alien-callback ; : callback-1 ( -- callback ) void { } cdecl [ ] alien-callback ;
[ 0 1 ] [ [ callback-1 ] infer [ in>> length ] [ out>> length ] bi ] unit-test [ 0 1 ] [ [ callback-1 ] infer [ in>> length ] [ out>> length ] bi ] unit-test
[ t ] [ callback-1 alien? ] unit-test [ t ] [ callback-1 alien? ] unit-test
: callback_test_1 ( ptr -- ) void { } "cdecl" alien-indirect ; : callback_test_1 ( ptr -- ) void { } cdecl alien-indirect ;
[ ] [ callback-1 callback_test_1 ] unit-test [ ] [ callback-1 callback_test_1 ] unit-test
: callback-2 ( -- callback ) void { } "cdecl" [ [ 5 throw ] ignore-errors ] alien-callback ; : callback-2 ( -- callback ) void { } cdecl [ [ 5 throw ] ignore-errors ] alien-callback ;
[ ] [ callback-2 callback_test_1 ] unit-test [ ] [ callback-2 callback_test_1 ] unit-test
: callback-3 ( -- callback ) void { } "cdecl" [ 5 "x" set ] alien-callback ; : callback-3 ( -- callback ) void { } cdecl [ 5 "x" set ] alien-callback ;
[ t 3 5 ] [ [ t 3 5 ] [
[ [
@ -340,38 +340,38 @@ FUNCTION: ulonglong ffi_test_38 ( ulonglong x, ulonglong y ) ;
] unit-test ] unit-test
: callback-5 ( -- callback ) : callback-5 ( -- callback )
void { } "cdecl" [ gc ] alien-callback ; void { } cdecl [ gc ] alien-callback ;
[ "testing" ] [ [ "testing" ] [
"testing" callback-5 callback_test_1 "testing" callback-5 callback_test_1
] unit-test ] unit-test
: callback-5b ( -- callback ) : callback-5b ( -- callback )
void { } "cdecl" [ compact-gc ] alien-callback ; void { } cdecl [ compact-gc ] alien-callback ;
[ "testing" ] [ [ "testing" ] [
"testing" callback-5b callback_test_1 "testing" callback-5b callback_test_1
] unit-test ] unit-test
: callback-6 ( -- callback ) : callback-6 ( -- callback )
void { } "cdecl" [ [ continue ] callcc0 ] alien-callback ; void { } cdecl [ [ continue ] callcc0 ] alien-callback ;
[ 1 2 3 ] [ callback-6 callback_test_1 1 2 3 ] unit-test [ 1 2 3 ] [ callback-6 callback_test_1 1 2 3 ] unit-test
: callback-7 ( -- callback ) : callback-7 ( -- callback )
void { } "cdecl" [ 1000000 sleep ] alien-callback ; void { } cdecl [ 1000000 sleep ] alien-callback ;
[ 1 2 3 ] [ callback-7 callback_test_1 1 2 3 ] unit-test [ 1 2 3 ] [ callback-7 callback_test_1 1 2 3 ] unit-test
[ f ] [ namespace global eq? ] unit-test [ f ] [ namespace global eq? ] unit-test
: callback-8 ( -- callback ) : callback-8 ( -- callback )
void { } "cdecl" [ [ ] in-thread yield ] alien-callback ; void { } cdecl [ [ ] in-thread yield ] alien-callback ;
[ ] [ callback-8 callback_test_1 ] unit-test [ ] [ callback-8 callback_test_1 ] unit-test
: callback-9 ( -- callback ) : callback-9 ( -- callback )
int { int int int } "cdecl" [ int { int int int } cdecl [
+ + 1 + + + 1 +
] alien-callback ; ] alien-callback ;
@ -429,13 +429,13 @@ STRUCT: double-rect
} cleave ; } cleave ;
: double-rect-callback ( -- alien ) : double-rect-callback ( -- alien )
void { void* void* double-rect } "cdecl" void { void* void* double-rect } cdecl
[ "example" set-global 2drop ] alien-callback ; [ "example" set-global 2drop ] alien-callback ;
: double-rect-test ( arg -- arg' ) : double-rect-test ( arg -- arg' )
f f rot f f rot
double-rect-callback double-rect-callback
void { void* void* double-rect } "cdecl" alien-indirect void { void* void* double-rect } cdecl alien-indirect
"example" get-global ; "example" get-global ;
[ 1.0 2.0 3.0 4.0 ] [ 1.0 2.0 3.0 4.0 ]
@ -452,7 +452,7 @@ FUNCTION: test_struct_14 ffi_test_40 ( double x1, double x2 ) ;
] unit-test ] unit-test
: callback-10 ( -- callback ) : callback-10 ( -- callback )
test_struct_14 { double double } "cdecl" test_struct_14 { double double } cdecl
[ [
test_struct_14 <struct> test_struct_14 <struct>
swap >>x2 swap >>x2
@ -460,7 +460,7 @@ FUNCTION: test_struct_14 ffi_test_40 ( double x1, double x2 ) ;
] alien-callback ; ] alien-callback ;
: callback-10-test ( x1 x2 callback -- result ) : callback-10-test ( x1 x2 callback -- result )
test_struct_14 { double double } "cdecl" alien-indirect ; test_struct_14 { double double } cdecl alien-indirect ;
[ 1.0 2.0 ] [ [ 1.0 2.0 ] [
1.0 2.0 callback-10 callback-10-test 1.0 2.0 callback-10 callback-10-test
@ -475,7 +475,7 @@ FUNCTION: test-struct-12 ffi_test_41 ( int a, double x ) ;
] unit-test ] unit-test
: callback-11 ( -- callback ) : callback-11 ( -- callback )
test-struct-12 { int double } "cdecl" test-struct-12 { int double } cdecl
[ [
test-struct-12 <struct> test-struct-12 <struct>
swap >>x swap >>x
@ -483,7 +483,7 @@ FUNCTION: test-struct-12 ffi_test_41 ( int a, double x ) ;
] alien-callback ; ] alien-callback ;
: callback-11-test ( x1 x2 callback -- result ) : callback-11-test ( x1 x2 callback -- result )
test-struct-12 { int double } "cdecl" alien-indirect ; test-struct-12 { int double } cdecl alien-indirect ;
[ 1 2.0 ] [ [ 1 2.0 ] [
1 2.0 callback-11 callback-11-test 1 2.0 callback-11 callback-11-test
@ -499,7 +499,7 @@ FUNCTION: test_struct_15 ffi_test_42 ( float x, float y ) ;
[ 1.0 2.0 ] [ 1.0 2.0 ffi_test_42 [ x>> ] [ y>> ] bi ] unit-test [ 1.0 2.0 ] [ 1.0 2.0 ffi_test_42 [ x>> ] [ y>> ] bi ] unit-test
: callback-12 ( -- callback ) : callback-12 ( -- callback )
test_struct_15 { float float } "cdecl" test_struct_15 { float float } cdecl
[ [
test_struct_15 <struct> test_struct_15 <struct>
swap >>y swap >>y
@ -507,7 +507,7 @@ FUNCTION: test_struct_15 ffi_test_42 ( float x, float y ) ;
] alien-callback ; ] alien-callback ;
: callback-12-test ( x1 x2 callback -- result ) : callback-12-test ( x1 x2 callback -- result )
test_struct_15 { float float } "cdecl" alien-indirect ; test_struct_15 { float float } cdecl alien-indirect ;
[ 1.0 2.0 ] [ [ 1.0 2.0 ] [
1.0 2.0 callback-12 callback-12-test [ x>> ] [ y>> ] bi 1.0 2.0 callback-12 callback-12-test [ x>> ] [ y>> ] bi
@ -522,7 +522,7 @@ FUNCTION: test_struct_16 ffi_test_43 ( float x, int a ) ;
[ 1.0 2 ] [ 1.0 2 ffi_test_43 [ x>> ] [ a>> ] bi ] unit-test [ 1.0 2 ] [ 1.0 2 ffi_test_43 [ x>> ] [ a>> ] bi ] unit-test
: callback-13 ( -- callback ) : callback-13 ( -- callback )
test_struct_16 { float int } "cdecl" test_struct_16 { float int } cdecl
[ [
test_struct_16 <struct> test_struct_16 <struct>
swap >>a swap >>a
@ -530,7 +530,7 @@ FUNCTION: test_struct_16 ffi_test_43 ( float x, int a ) ;
] alien-callback ; ] alien-callback ;
: callback-13-test ( x1 x2 callback -- result ) : callback-13-test ( x1 x2 callback -- result )
test_struct_16 { float int } "cdecl" alien-indirect ; test_struct_16 { float int } cdecl alien-indirect ;
[ 1.0 2 ] [ [ 1.0 2 ] [
1.0 2 callback-13 callback-13-test 1.0 2 callback-13 callback-13-test
@ -581,13 +581,13 @@ FUNCTION: short ffi_test_48 ( bool-field-test x ) ;
! Test interaction between threads and callbacks ! Test interaction between threads and callbacks
: thread-callback-1 ( -- callback ) : thread-callback-1 ( -- callback )
int { } "cdecl" [ yield 100 ] alien-callback ; int { } cdecl [ yield 100 ] alien-callback ;
: thread-callback-2 ( -- callback ) : thread-callback-2 ( -- callback )
int { } "cdecl" [ yield 200 ] alien-callback ; int { } cdecl [ yield 200 ] alien-callback ;
: thread-callback-invoker ( callback -- n ) : thread-callback-invoker ( callback -- n )
int { } "cdecl" alien-indirect ; int { } cdecl alien-indirect ;
<promise> "p" set <promise> "p" set
[ thread-callback-1 thread-callback-invoker "p" get fulfill ] in-thread [ thread-callback-1 thread-callback-invoker "p" get fulfill ] in-thread
@ -600,6 +600,6 @@ FUNCTION: void this_does_not_exist ( ) ;
[ this_does_not_exist ] [ { "kernel-error" 9 f f } = ] must-fail-with [ this_does_not_exist ] [ { "kernel-error" 9 f f } = ] must-fail-with
! More alien-assembly tests are in cpu.* vocabs ! More alien-assembly tests are in cpu.* vocabs
: assembly-test-1 ( -- ) void { } "cdecl" [ ] alien-assembly ; : assembly-test-1 ( -- ) void { } cdecl [ ] alien-assembly ;
[ ] [ assembly-test-1 ] unit-test [ ] [ assembly-test-1 ] unit-test

View File

@ -7,12 +7,12 @@ TYPEDEF: alien.c-types:int type-1
TYPEDEF: alien.c-types:int type-3 TYPEDEF: alien.c-types:int type-3
: callback ( -- ptr ) : callback ( -- ptr )
type-3 { type-1 type-1 } "cdecl" [ + >integer ] alien-callback ; type-3 { type-1 type-1 } cdecl [ + >integer ] alien-callback ;
TYPEDEF: alien.c-types:float type-2 TYPEDEF: alien.c-types:float type-2
: indirect ( x y ptr -- z ) : indirect ( x y ptr -- z )
type-3 { type-2 type-2 } "cdecl" alien-indirect ; type-3 { type-2 type-2 } cdecl alien-indirect ;
[ ] [ [ ] [
"USING: alien.c-types alien.syntax ; "USING: alien.c-types alien.syntax ;

View File

@ -8,7 +8,7 @@ IN: compression.zlib.ffi
{ [ os winnt? ] [ "zlib1.dll" ] } { [ os winnt? ] [ "zlib1.dll" ] }
{ [ os macosx? ] [ "libz.dylib" ] } { [ os macosx? ] [ "libz.dylib" ] }
{ [ os unix? ] [ "libz.so" ] } { [ os unix? ] [ "libz.so" ] }
} cond "cdecl" add-library >> } cond cdecl add-library >>
LIBRARY: zlib LIBRARY: zlib

View File

@ -120,7 +120,7 @@ PRIVATE>
[ fds>> [ enable-all-callbacks ] each ] bi ; [ fds>> [ enable-all-callbacks ] each ] bi ;
: timer-callback ( -- callback ) : timer-callback ( -- callback )
void { CFRunLoopTimerRef void* } "cdecl" void { CFRunLoopTimerRef void* } cdecl
[ 2drop reset-run-loop yield ] alien-callback ; [ 2drop reset-run-loop yield ] alien-callback ;
: init-thread-timer ( -- ) : init-thread-timer ( -- )

View File

@ -2,6 +2,6 @@ IN: cpu.x86.32.tests
USING: alien alien.c-types tools.test cpu.x86.assembler USING: alien alien.c-types tools.test cpu.x86.assembler
cpu.x86.assembler.operands ; cpu.x86.assembler.operands ;
: assembly-test-1 ( -- x ) int { } "cdecl" [ EAX 3 MOV ] alien-assembly ; : assembly-test-1 ( -- x ) int { } cdecl [ EAX 3 MOV ] alien-assembly ;
[ 3 ] [ assembly-test-1 ] unit-test [ 3 ] [ assembly-test-1 ] unit-test

View File

@ -2,12 +2,12 @@ USING: alien alien.c-types cpu.architecture cpu.x86.64
cpu.x86.assembler cpu.x86.assembler.operands tools.test ; cpu.x86.assembler cpu.x86.assembler.operands tools.test ;
IN: cpu.x86.64.tests IN: cpu.x86.64.tests
: assembly-test-1 ( -- x ) int { } "cdecl" [ RAX 3 MOV ] alien-assembly ; : assembly-test-1 ( -- x ) int { } cdecl [ RAX 3 MOV ] alien-assembly ;
[ 3 ] [ assembly-test-1 ] unit-test [ 3 ] [ assembly-test-1 ] unit-test
: assembly-test-2 ( a b -- x ) : assembly-test-2 ( a b -- x )
int { int int } "cdecl" [ int { int int } cdecl [
param-reg-0 param-reg-1 ADD param-reg-0 param-reg-1 ADD
int-regs return-reg param-reg-0 MOV int-regs return-reg param-reg-0 MOV
] alien-assembly ; ] alien-assembly ;

View File

@ -9,7 +9,7 @@ IN: cpu.x86.features
<PRIVATE <PRIVATE
: (sse-version) ( -- n ) : (sse-version) ( -- n )
int { } "cdecl" [ int { } cdecl [
"sse-42" define-label "sse-42" define-label
"sse-41" define-label "sse-41" define-label
"ssse-3" define-label "ssse-3" define-label
@ -97,12 +97,12 @@ MEMO: sse-version ( -- n )
HOOK: instruction-count cpu ( -- n ) HOOK: instruction-count cpu ( -- n )
M: x86.32 instruction-count M: x86.32 instruction-count
longlong { } "cdecl" [ longlong { } cdecl [
RDTSC RDTSC
] alien-assembly ; ] alien-assembly ;
M: x86.64 instruction-count M: x86.64 instruction-count
longlong { } "cdecl" [ longlong { } cdecl [
RAX 0 MOV RAX 0 MOV
RDTSC RDTSC
RDX 32 SHL RDX 32 SHL

View File

@ -9,7 +9,7 @@ IN: db.postgresql.ffi
{ [ os winnt? ] [ "libpq.dll" ] } { [ os winnt? ] [ "libpq.dll" ] }
{ [ os macosx? ] [ "libpq.dylib" ] } { [ os macosx? ] [ "libpq.dylib" ] }
{ [ os unix? ] [ "libpq.so" ] } { [ os unix? ] [ "libpq.so" ] }
} cond "cdecl" add-library >> } cond cdecl add-library >>
! ConnSatusType ! ConnSatusType
CONSTANT: CONNECTION_OK HEX: 0 CONSTANT: CONNECTION_OK HEX: 0

View File

@ -10,7 +10,7 @@ IN: db.sqlite.ffi
{ [ os winnt? ] [ "sqlite3.dll" ] } { [ os winnt? ] [ "sqlite3.dll" ] }
{ [ os macosx? ] [ "/usr/lib/libsqlite3.dylib" ] } { [ os macosx? ] [ "/usr/lib/libsqlite3.dylib" ] }
{ [ os unix? ] [ "libsqlite3.so" ] } { [ os unix? ] [ "libsqlite3.so" ] }
} cond "cdecl" add-library >> } cond cdecl add-library >>
! Return values from sqlite functions ! Return values from sqlite functions
CONSTANT: SQLITE_OK 0 ! Successful result CONSTANT: SQLITE_OK 0 ! Successful result

View File

@ -8,14 +8,14 @@ IN: glib
<< <<
{ {
{ [ os winnt? ] [ "glib" "libglib-2.0-0.dll" "cdecl" add-library ] } { [ os winnt? ] [ "glib" "libglib-2.0-0.dll" cdecl add-library ] }
{ [ os macosx? ] [ "glib" "/opt/local/lib/libglib-2.0.0.dylib" "cdecl" add-library ] } { [ os macosx? ] [ "glib" "/opt/local/lib/libglib-2.0.0.dylib" cdecl add-library ] }
{ [ os unix? ] [ ] } { [ os unix? ] [ ] }
} cond } cond
{ {
{ [ os winnt? ] [ "gobject" "libgobject-2.0-0.dll" "cdecl" add-library ] } { [ os winnt? ] [ "gobject" "libgobject-2.0-0.dll" cdecl add-library ] }
{ [ os macosx? ] [ "gobject" "/opt/local/lib/libgobject-2.0.0.dylib" "cdecl" add-library ] } { [ os macosx? ] [ "gobject" "/opt/local/lib/libgobject-2.0.0.dylib" cdecl add-library ] }
{ [ os unix? ] [ ] } { [ os unix? ] [ ] }
} cond } cond

View File

@ -11,7 +11,7 @@ TUPLE: run-loop-mx kqueue-mx ;
: file-descriptor-callback ( -- callback ) : file-descriptor-callback ( -- callback )
void { CFFileDescriptorRef CFOptionFlags void* } void { CFFileDescriptorRef CFOptionFlags void* }
"cdecl" [ cdecl [
3drop 3drop
0 mx get kqueue-mx>> wait-for-events 0 mx get kqueue-mx>> wait-for-events
reset-run-loop reset-run-loop

View File

@ -31,7 +31,7 @@ TUPLE: openssl-context < secure-context aliens sessions ;
] [ drop ] if ; ] [ drop ] if ;
: password-callback ( -- alien ) : password-callback ( -- alien )
int { void* int bool void* } "cdecl" int { void* int bool void* } cdecl
[| buf size rwflag password! | [| buf size rwflag password! |
password [ B{ 0 } password! ] unless password [ B{ 0 } password! ] unless

View File

@ -3,26 +3,26 @@ cpu.x86.assembler.operands math.floats.env.x86 system ;
IN: math.floats.env.x86.32 IN: math.floats.env.x86.32
M: x86.32 get-sse-env M: x86.32 get-sse-env
void { void* } "cdecl" [ void { void* } cdecl [
EAX ESP [] MOV EAX ESP [] MOV
EAX [] STMXCSR EAX [] STMXCSR
] alien-assembly ; ] alien-assembly ;
M: x86.32 set-sse-env M: x86.32 set-sse-env
void { void* } "cdecl" [ void { void* } cdecl [
EAX ESP [] MOV EAX ESP [] MOV
EAX [] LDMXCSR EAX [] LDMXCSR
] alien-assembly ; ] alien-assembly ;
M: x86.32 get-x87-env M: x86.32 get-x87-env
void { void* } "cdecl" [ void { void* } cdecl [
EAX ESP [] MOV EAX ESP [] MOV
EAX [] FNSTSW EAX [] FNSTSW
EAX 2 [+] FNSTCW EAX 2 [+] FNSTCW
] alien-assembly ; ] alien-assembly ;
M: x86.32 set-x87-env M: x86.32 set-x87-env
void { void* } "cdecl" [ void { void* } cdecl [
EAX ESP [] MOV EAX ESP [] MOV
FNCLEX FNCLEX
EAX 2 [+] FLDCW EAX 2 [+] FLDCW

View File

@ -3,23 +3,23 @@ cpu.x86.assembler.operands math.floats.env.x86 sequences system ;
IN: math.floats.env.x86.64 IN: math.floats.env.x86.64
M: x86.64 get-sse-env M: x86.64 get-sse-env
void { void* } "cdecl" [ void { void* } cdecl [
int-regs param-regs first [] STMXCSR int-regs param-regs first [] STMXCSR
] alien-assembly ; ] alien-assembly ;
M: x86.64 set-sse-env M: x86.64 set-sse-env
void { void* } "cdecl" [ void { void* } cdecl [
int-regs param-regs first [] LDMXCSR int-regs param-regs first [] LDMXCSR
] alien-assembly ; ] alien-assembly ;
M: x86.64 get-x87-env M: x86.64 get-x87-env
void { void* } "cdecl" [ void { void* } cdecl [
int-regs param-regs first [] FNSTSW int-regs param-regs first [] FNSTSW
int-regs param-regs first 2 [+] FNSTCW int-regs param-regs first 2 [+] FNSTCW
] alien-assembly ; ] alien-assembly ;
M: x86.64 set-x87-env M: x86.64 set-x87-env
void { void* } "cdecl" [ void { void* } cdecl [
FNCLEX FNCLEX
int-regs param-regs first 2 [+] FLDCW int-regs param-regs first 2 [+] FLDCW
] alien-assembly ; ] alien-assembly ;

View File

@ -3,4 +3,4 @@ IN: opengl.gl.macosx
: gl-function-context ( -- context ) 0 ; inline : gl-function-context ( -- context ) 0 ; inline
: gl-function-address ( name -- address ) f dlsym ; inline : gl-function-address ( name -- address ) f dlsym ; inline
: gl-function-calling-convention ( -- str ) "cdecl" ; inline : gl-function-calling-convention ( -- str ) cdecl ; inline

View File

@ -3,4 +3,4 @@ IN: opengl.gl.unix
: gl-function-context ( -- context ) glXGetCurrentContext ; inline : gl-function-context ( -- context ) glXGetCurrentContext ; inline
: gl-function-address ( name -- address ) glXGetProcAddressARB ; inline : gl-function-address ( name -- address ) glXGetProcAddressARB ; inline
: gl-function-calling-convention ( -- str ) "cdecl" ; inline : gl-function-calling-convention ( -- str ) cdecl ; inline

View File

@ -14,9 +14,9 @@ IN: openssl.libcrypto
{ {
{ [ os openbsd? ] [ ] } ! VM is linked with it { [ os openbsd? ] [ ] } ! VM is linked with it
{ [ os netbsd? ] [ ] } { [ os netbsd? ] [ ] }
{ [ os winnt? ] [ "libcrypto" "libeay32.dll" "cdecl" add-library ] } { [ os winnt? ] [ "libcrypto" "libeay32.dll" cdecl add-library ] }
{ [ os macosx? ] [ "libcrypto" "libcrypto.dylib" "cdecl" add-library ] } { [ os macosx? ] [ "libcrypto" "libcrypto.dylib" cdecl add-library ] }
{ [ os unix? ] [ "libcrypto" "libcrypto.so" "cdecl" add-library ] } { [ os unix? ] [ "libcrypto" "libcrypto.so" cdecl add-library ] }
} cond } cond
>> >>

View File

@ -10,9 +10,9 @@ IN: openssl.libssl
<< { << {
{ [ os openbsd? ] [ ] } ! VM is linked with it { [ os openbsd? ] [ ] } ! VM is linked with it
{ [ os netbsd? ] [ ] } { [ os netbsd? ] [ ] }
{ [ os winnt? ] [ "libssl" "ssleay32.dll" "cdecl" add-library ] } { [ os winnt? ] [ "libssl" "ssleay32.dll" cdecl add-library ] }
{ [ os macosx? ] [ "libssl" "libssl.dylib" "cdecl" add-library ] } { [ os macosx? ] [ "libssl" "libssl.dylib" cdecl add-library ] }
{ [ os unix? ] [ "libssl" "libssl.so" "cdecl" add-library ] } { [ os unix? ] [ "libssl" "libssl.so" cdecl add-library ] }
} cond >> } cond >>
CONSTANT: X509_FILETYPE_PEM 1 CONSTANT: X509_FILETYPE_PEM 1

View File

@ -12,8 +12,8 @@ classes.struct cairo cairo.ffi ;
IN: pango.cairo IN: pango.cairo
<< { << {
{ [ os winnt? ] [ "pangocairo" "libpangocairo-1.0-0.dll" "cdecl" add-library ] } { [ os winnt? ] [ "pangocairo" "libpangocairo-1.0-0.dll" cdecl add-library ] }
{ [ os macosx? ] [ "pangocairo" "/opt/local/lib/libpangocairo-1.0.0.dylib" "cdecl" add-library ] } { [ os macosx? ] [ "pangocairo" "/opt/local/lib/libpangocairo-1.0.0.dylib" cdecl add-library ] }
{ [ os unix? ] [ ] } { [ os unix? ] [ ] }
} cond >> } cond >>

View File

@ -11,8 +11,8 @@ IN: pango
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<< { << {
{ [ os winnt? ] [ "pango" "libpango-1.0-0.dll" "cdecl" add-library ] } { [ os winnt? ] [ "pango" "libpango-1.0-0.dll" cdecl add-library ] }
{ [ os macosx? ] [ "pango" "/opt/local/lib/libpango-1.0.0.dylib" "cdecl" add-library ] } { [ os macosx? ] [ "pango" "/opt/local/lib/libpango-1.0.0.dylib" cdecl add-library ] }
{ [ os unix? ] [ ] } { [ os unix? ] [ ] }
} cond >> } cond >>

View File

@ -2,9 +2,9 @@ USING: alien alien.c-types kernel math ;
IN: tools.deploy.test.9 IN: tools.deploy.test.9
: callback-test ( -- callback ) : callback-test ( -- callback )
int { int } "cdecl" [ 1 + ] alien-callback ; int { int } cdecl [ 1 + ] alien-callback ;
: indirect-test ( -- ) : indirect-test ( -- )
10 callback-test int { int } "cdecl" alien-indirect 11 assert= ; 10 callback-test int { int } cdecl alien-indirect 11 assert= ;
MAIN: indirect-test MAIN: indirect-test

View File

@ -12,7 +12,7 @@ IN: tools.disassembler.udis
{ [ os macosx? ] [ "libudis86.0.dylib" ] } { [ os macosx? ] [ "libudis86.0.dylib" ] }
{ [ os unix? ] [ "libudis86.so.0" ] } { [ os unix? ] [ "libudis86.so.0" ] }
{ [ os winnt? ] [ "libudis86.dll" ] } { [ os winnt? ] [ "libudis86.dll" ] }
} cond "cdecl" add-library } cond cdecl add-library
>> >>
LIBRARY: libudis86 LIBRARY: libudis86

View File

@ -21,9 +21,9 @@ IN: tools.profiler.tests
[ ] [ \ + usage-profile. ] unit-test [ ] [ \ + usage-profile. ] unit-test
: callback-test ( -- callback ) void { } "cdecl" [ ] alien-callback ; : callback-test ( -- callback ) void { } cdecl [ ] alien-callback ;
: indirect-test ( callback -- ) void { } "cdecl" alien-indirect ; : indirect-test ( callback -- ) void { } cdecl alien-indirect ;
: foobar ( -- ) ; : foobar ( -- ) ;

View File

@ -156,4 +156,4 @@ FUNCTION: int unlink ( c-string path ) ;
FUNCTION: int utimes ( c-string path, timeval[2] times ) ; FUNCTION: int utimes ( c-string path, timeval[2] times ) ;
FUNCTION: ssize_t write ( int fd, void* buf, size_t nbytes ) ; FUNCTION: ssize_t write ( int fd, void* buf, size_t nbytes ) ;
"librt" "librt.so" "cdecl" add-library "librt" "librt.so" cdecl add-library

View File

@ -8,8 +8,8 @@ USING: alien sequences alien.libraries ;
{ "winsock" "ws2_32.dll" "stdcall" } { "winsock" "ws2_32.dll" "stdcall" }
{ "mswsock" "mswsock.dll" "stdcall" } { "mswsock" "mswsock.dll" "stdcall" }
{ "shell32" "shell32.dll" "stdcall" } { "shell32" "shell32.dll" "stdcall" }
{ "libc" "msvcrt.dll" "cdecl" } { "libc" "msvcrt.dll" cdecl }
{ "libm" "msvcrt.dll" "cdecl" } { "libm" "msvcrt.dll" cdecl }
{ "gl" "opengl32.dll" "stdcall" } { "gl" "opengl32.dll" "stdcall" }
{ "glu" "glu32.dll" "stdcall" } { "glu" "glu32.dll" "stdcall" }
{ "ole32" "ole32.dll" "stdcall" } { "ole32" "ole32.dll" "stdcall" }

View File

@ -2,12 +2,12 @@ USING: math kernel alien alien.c-types ;
IN: benchmark.fib6 IN: benchmark.fib6
: fib ( x -- y ) : fib ( x -- y )
int { int } "cdecl" [ int { int } cdecl [
dup 1 <= [ drop 1 ] [ dup 1 <= [ drop 1 ] [
1 - dup fib swap 1 - fib + 1 - dup fib swap 1 - fib +
] if ] if
] alien-callback ] alien-callback
int { int } "cdecl" alien-indirect ; int { int } cdecl alien-indirect ;
: fib-main ( -- ) 32 fib drop ; : fib-main ( -- ) 32 fib drop ;

View File

@ -11,7 +11,7 @@ IN: chipmunk.ffi
{ [ os windows? ] [ "chipmunk.dll" ] } { [ os windows? ] [ "chipmunk.dll" ] }
{ [ os macosx? ] [ "libchipmunk.dylib" ] } { [ os macosx? ] [ "libchipmunk.dylib" ] }
{ [ os unix? ] [ "libchipmunk.so" ] } { [ os unix? ] [ "libchipmunk.so" ] }
} cond "cdecl" add-library } cond cdecl add-library
"chipmunk" deploy-library "chipmunk" deploy-library
>> >>

View File

@ -8,7 +8,7 @@ IN: curses.ffi
{ [ os winnt? ] [ "libcurses.dll" ] } { [ os winnt? ] [ "libcurses.dll" ] }
{ [ os macosx? ] [ "libcurses.dylib" ] } { [ os macosx? ] [ "libcurses.dylib" ] }
{ [ os unix? ] [ "libcurses.so" ] } { [ os unix? ] [ "libcurses.so" ] }
} cond "cdecl" add-library >> } cond cdecl add-library >>
C-TYPE: WINDOW C-TYPE: WINDOW
C-TYPE: SCREEN C-TYPE: SCREEN

View File

@ -1,5 +1,5 @@
! (c)2010 Joe Groff bsd license ! (c)2010 Joe Groff bsd license
USING: accessors cursors make math sequences sorting tools.test ; USING: accessors cursors kernel make math sequences sorting tools.test ;
FROM: cursors => each map assoc-each assoc>map ; FROM: cursors => each map assoc-each assoc>map ;
IN: cursors.tests IN: cursors.tests
@ -12,6 +12,10 @@ IN: cursors.tests
T{ linear-cursor f 1 1 } T{ linear-cursor f 5 1 } [ value>> 3 mod zero? ] -find T{ linear-cursor f 1 1 } T{ linear-cursor f 5 1 } [ value>> 3 mod zero? ] -find
] unit-test ] unit-test
[ T{ linear-cursor f 5 1 } ] [
T{ linear-cursor f 1 1 } T{ linear-cursor f 5 1 } [ value>> 6 = ] -find
] unit-test
[ { 1 3 } ] [ [ { 1 3 } ] [
[ T{ linear-cursor f 1 2 } T{ linear-cursor f 5 2 } [ value>> , ] -each ] [ T{ linear-cursor f 1 2 } T{ linear-cursor f 5 2 } [ value>> , ] -each ]
{ } make { } make

View File

@ -5,8 +5,8 @@ alien.libraries classes.struct ;
IN: freetype IN: freetype
<< "freetype" { << "freetype" {
{ [ os macosx? ] [ "/usr/X11R6/lib/libfreetype.6.dylib" "cdecl" add-library ] } { [ os macosx? ] [ "/usr/X11R6/lib/libfreetype.6.dylib" cdecl add-library ] }
{ [ os windows? ] [ "freetype6.dll" "cdecl" add-library ] } { [ os windows? ] [ "freetype6.dll" cdecl add-library ] }
{ [ t ] [ drop ] } { [ t ] [ drop ] }
} cond >> } cond >>

View File

@ -11,7 +11,7 @@ IN: libusb
{ [ os windows? ] [ "libusb-1.0.dll" ] } { [ os windows? ] [ "libusb-1.0.dll" ] }
{ [ os macosx? ] [ "libusb-1.0.dylib" ] } { [ os macosx? ] [ "libusb-1.0.dylib" ] }
{ [ os unix? ] [ "libusb-1.0.so" ] } { [ os unix? ] [ "libusb-1.0.so" ] }
} cond "cdecl" add-library >> } cond cdecl add-library >>
LIBRARY: libusb LIBRARY: libusb
: libusb_cpu_to_le16 ( x -- y ) : libusb_cpu_to_le16 ( x -- y )

View File

@ -12,7 +12,7 @@ IN: llvm.core
{ [ os macosx? ] [ "/usr/local/lib/lib" ".dylib" surround ] } { [ os macosx? ] [ "/usr/local/lib/lib" ".dylib" surround ] }
{ [ os windows? ] [ ".dll" append ] } { [ os windows? ] [ ".dll" append ] }
{ [ os unix? ] [ "lib" ".so" surround ] } { [ os unix? ] [ "lib" ".so" surround ] }
} cond "cdecl" add-library ; } cond cdecl add-library ;
"LLVMSystem" add-llvm-library "LLVMSystem" add-llvm-library
"LLVMSupport" add-llvm-library "LLVMSupport" add-llvm-library

View File

@ -41,7 +41,7 @@ TUPLE: function name alien return params ;
dup name>> function-pointer , dup name>> function-pointer ,
dup return>> c-type , dup return>> c-type ,
dup params>> [ second c-type ] map , dup params>> [ second c-type ] map ,
"cdecl" , \ alien-indirect , cdecl , \ alien-indirect ,
] [ ] make swap function-effect [ define-declared ] with-compilation-unit ; ] [ ] make swap function-effect [ define-declared ] with-compilation-unit ;
: install-module ( name -- ) : install-module ( name -- )

View File

@ -18,7 +18,7 @@ IN: ogg
{ [ os winnt? ] [ "ogg.dll" ] } { [ os winnt? ] [ "ogg.dll" ] }
{ [ os macosx? ] [ "libogg.0.dylib" ] } { [ os macosx? ] [ "libogg.0.dylib" ] }
{ [ os unix? ] [ "libogg.so" ] } { [ os unix? ] [ "libogg.so" ] }
} cond "cdecl" add-library } cond cdecl add-library
"ogg" deploy-library "ogg" deploy-library
>> >>

View File

@ -19,13 +19,13 @@ IN: ogg.theora
{ [ os winnt? ] [ "theoradec.dll" ] } { [ os winnt? ] [ "theoradec.dll" ] }
{ [ os macosx? ] [ "libtheoradec.0.dylib" ] } { [ os macosx? ] [ "libtheoradec.0.dylib" ] }
{ [ os unix? ] [ "libtheoradec.so" ] } { [ os unix? ] [ "libtheoradec.so" ] }
} cond "cdecl" add-library } cond cdecl add-library
"theoraenc" { "theoraenc" {
{ [ os winnt? ] [ "theoraenc.dll" ] } { [ os winnt? ] [ "theoraenc.dll" ] }
{ [ os macosx? ] [ "libtheoraenc.0.dylib" ] } { [ os macosx? ] [ "libtheoraenc.0.dylib" ] }
{ [ os unix? ] [ "libtheoraenc.so" ] } { [ os unix? ] [ "libtheoraenc.so" ] }
} cond "cdecl" add-library } cond cdecl add-library
>> >>
CONSTANT: TH-EFAULT -1 CONSTANT: TH-EFAULT -1

View File

@ -19,7 +19,7 @@ IN: ogg.vorbis
{ [ os winnt? ] [ "vorbis.dll" ] } { [ os winnt? ] [ "vorbis.dll" ] }
{ [ os macosx? ] [ "libvorbis.0.dylib" ] } { [ os macosx? ] [ "libvorbis.0.dylib" ] }
{ [ os unix? ] [ "libvorbis.so" ] } { [ os unix? ] [ "libvorbis.so" ] }
} cond "cdecl" add-library } cond cdecl add-library
"vorbis" deploy-library "vorbis" deploy-library
>> >>

View File

@ -14,7 +14,7 @@ IN: openal.alut
"/System/Library/Frameworks/OpenAL.framework/OpenAL" "/System/Library/Frameworks/OpenAL.framework/OpenAL"
] } ] }
{ [ os unix? ] [ "libalut.so" ] } { [ os unix? ] [ "libalut.so" ] }
} cond "cdecl" add-library >> } cond cdecl add-library >>
<< os macosx? [ "alut" deploy-library ] unless >> << os macosx? [ "alut" deploy-library ] unless >>

View File

@ -14,7 +14,7 @@ IN: openal
"/System/Library/Frameworks/OpenAL.framework/OpenAL" "/System/Library/Frameworks/OpenAL.framework/OpenAL"
] } ] }
{ [ os unix? ] [ "libopenal.so" ] } { [ os unix? ] [ "libopenal.so" ] }
} cond "cdecl" add-library >> } cond cdecl add-library >>
<< os macosx? [ "openal" deploy-library ] unless >> << os macosx? [ "openal" deploy-library ] unless >>

View File

@ -9,7 +9,7 @@ IN: opengl.glu
os { os {
{ [ dup macosx? ] [ drop ] } { [ dup macosx? ] [ drop ] }
{ [ dup windows? ] [ drop ] } { [ dup windows? ] [ drop ] }
{ [ dup unix? ] [ drop "glu" "libGLU.so.1" "cdecl" add-library ] } { [ dup unix? ] [ drop "glu" "libGLU.so.1" cdecl add-library ] }
} cond } cond
>> >>

View File

@ -9,7 +9,7 @@ IN: tokyo.alien.tcrdb
{ [ os macosx? ] [ "/opt/local/lib/libtokyotyrant.dylib" ] } { [ os macosx? ] [ "/opt/local/lib/libtokyotyrant.dylib" ] }
{ [ os unix? ] [ "libtokyotyrant.so" ] } { [ os unix? ] [ "libtokyotyrant.so" ] }
{ [ os windows? ] [ "tokyotyrant.dll" ] } { [ os windows? ] [ "tokyotyrant.dll" ] }
} cond "cdecl" add-library >> } cond cdecl add-library >>
LIBRARY: tokyotyrant LIBRARY: tokyotyrant

View File

@ -8,7 +8,7 @@ IN: tokyo.alien.tcutil
{ [ os macosx? ] [ "/opt/local/lib/libtokyocabinet.dylib" ] } { [ os macosx? ] [ "/opt/local/lib/libtokyocabinet.dylib" ] }
{ [ os unix? ] [ "libtokyocabinet.so" ] } { [ os unix? ] [ "libtokyocabinet.so" ] }
{ [ os windows? ] [ "tokyocabinet.dll" ] } { [ os windows? ] [ "tokyocabinet.dll" ] }
} cond "cdecl" add-library >> } cond cdecl add-library >>
LIBRARY: tokyocabinet LIBRARY: tokyocabinet

View File

@ -76,7 +76,7 @@ PRIVATE>
: compile-c-library ( -- ) : compile-c-library ( -- )
compile-library? [ compile-library ] when compile-library? [ compile-library ] when
c-library get dup library-path "cdecl" add-library ; c-library get dup library-path cdecl add-library ;
: define-c-function ( function types effect body -- ) : define-c-function ( function types effect body -- )
[ [

View File

@ -14,8 +14,8 @@ IN: cryptlib.libcl
<< "libcl" { << "libcl" {
{ [ win32? ] [ "cl32.dll" "stdcall" ] } { [ win32? ] [ "cl32.dll" "stdcall" ] }
{ [ macosx? ] [ "libcl.dylib" "cdecl" ] } { [ macosx? ] [ "libcl.dylib" cdecl ] }
{ [ unix? ] [ "libcl.so" "cdecl" ] } { [ unix? ] [ "libcl.so" cdecl ] }
} cond add-library >> } cond add-library >>
! =============================================== ! ===============================================

View File

@ -7,8 +7,8 @@ IN: db.mysql.ffi
<< "mysql" { << "mysql" {
{ [ os winnt? ] [ "libmySQL.dll" "stdcall" ] } { [ os winnt? ] [ "libmySQL.dll" "stdcall" ] }
{ [ os macosx? ] [ "libmysqlclient.14.dylib" "cdecl" ] } { [ os macosx? ] [ "libmysqlclient.14.dylib" cdecl ] }
{ [ os unix? ] [ "libmysqlclient.so.14" "cdecl" ] } { [ os unix? ] [ "libmysqlclient.so.14" cdecl ] }
} cond add-library >> } cond add-library >>
LIBRARY: mysql LIBRARY: mysql

View File

@ -296,61 +296,61 @@ FUNCTION: jint JNI_CreateJavaVM ( void** pvm, void** penv, void* args ) ;
] when ; ] when ;
: (destroy-java-vm) : (destroy-java-vm)
"int" { "void*" } "cdecl" alien-indirect ; "int" { "void*" } cdecl alien-indirect ;
: (attach-current-thread) : (attach-current-thread)
"int" { "void*" "void*" "void*" } "cdecl" alien-indirect ; "int" { "void*" "void*" "void*" } cdecl alien-indirect ;
: (detach-current-thread) : (detach-current-thread)
"int" { "void*" } "cdecl" alien-indirect ; "int" { "void*" } cdecl alien-indirect ;
: (get-env) : (get-env)
"int" { "void*" "void*" "int" } "cdecl" alien-indirect ; "int" { "void*" "void*" "int" } cdecl alien-indirect ;
: (attach-current-thread-as-daemon) : (attach-current-thread-as-daemon)
"int" { "void*" "void*" "void*" } "cdecl" alien-indirect ; "int" { "void*" "void*" "void*" } cdecl alien-indirect ;
: destroy-java-vm ( javavm -- int ) : destroy-java-vm ( javavm -- int )
dup JavaVM-functions JNIInvokeInterface-DestroyJavaVM (destroy-java-vm) ; dup JavaVM-functions JNIInvokeInterface-DestroyJavaVM (destroy-java-vm) ;
: (get-version) : (get-version)
"jint" { "JNIEnv*" } "cdecl" alien-indirect ; "jint" { "JNIEnv*" } cdecl alien-indirect ;
: get-version ( jnienv -- int ) : get-version ( jnienv -- int )
dup JNIEnv-functions JNINativeInterface-GetVersion (get-version) ; dup JNIEnv-functions JNINativeInterface-GetVersion (get-version) ;
: (find-class) : (find-class)
"void*" { "JNINativeInterface*" "char*" } "cdecl" alien-indirect ; "void*" { "JNINativeInterface*" "char*" } cdecl alien-indirect ;
: find-class ( name jnienv -- int ) : find-class ( name jnienv -- int )
dup swapd JNIEnv-functions JNINativeInterface-FindClass (find-class) ; dup swapd JNIEnv-functions JNINativeInterface-FindClass (find-class) ;
: (get-static-field-id) : (get-static-field-id)
"void*" { "JNINativeInterface*" "void*" "char*" "char*" } "cdecl" alien-indirect ; "void*" { "JNINativeInterface*" "void*" "char*" "char*" } cdecl alien-indirect ;
: get-static-field-id ( class name sig jnienv -- int ) : get-static-field-id ( class name sig jnienv -- int )
dup >r >r 3array r> swap first3 r> JNIEnv-functions JNINativeInterface-GetStaticFieldID (get-static-field-id) ; dup >r >r 3array r> swap first3 r> JNIEnv-functions JNINativeInterface-GetStaticFieldID (get-static-field-id) ;
: (get-static-object-field) : (get-static-object-field)
"void*" { "JNINativeInterface*" "void*" "void*" } "cdecl" alien-indirect ; "void*" { "JNINativeInterface*" "void*" "void*" } cdecl alien-indirect ;
: get-static-object-field ( class id jnienv -- int ) : get-static-object-field ( class id jnienv -- int )
dup >r >r 2array r> swap first2 r> JNIEnv-functions JNINativeInterface-GetStaticObjectField (get-static-object-field) ; dup >r >r 2array r> swap first2 r> JNIEnv-functions JNINativeInterface-GetStaticObjectField (get-static-object-field) ;
: (get-method-id) : (get-method-id)
"void*" { "JNINativeInterface*" "void*" "char*" "char*" } "cdecl" alien-indirect ; "void*" { "JNINativeInterface*" "void*" "char*" "char*" } cdecl alien-indirect ;
: get-method-id ( class name sig jnienv -- int ) : get-method-id ( class name sig jnienv -- int )
dup >r >r 3array r> swap first3 r> JNIEnv-functions JNINativeInterface-GetMethodID (get-method-id) ; dup >r >r 3array r> swap first3 r> JNIEnv-functions JNINativeInterface-GetMethodID (get-method-id) ;
: (new-string) : (new-string)
"void*" { "JNINativeInterface*" "char*" "int" } "cdecl" alien-indirect ; "void*" { "JNINativeInterface*" "char*" "int" } cdecl alien-indirect ;
: new-string ( str jnienv -- str ) : new-string ( str jnienv -- str )
dup >r >r dup length 2array r> swap first2 r> JNIEnv-functions JNINativeInterface-NewString (new-string) ; dup >r >r dup length 2array r> swap first2 r> JNIEnv-functions JNINativeInterface-NewString (new-string) ;
: (call1) : (call1)
"void" { "JNINativeInterface*" "void*" "void*" "int" } "cdecl" alien-indirect ; "void" { "JNINativeInterface*" "void*" "void*" "int" } cdecl alien-indirect ;
: call1 ( obj method-id jstr jnienv -- ) : call1 ( obj method-id jstr jnienv -- )
dup >r >r 3array r> swap first3 r> JNIEnv-functions JNINativeInterface-CallObjectMethod (call1) ; dup >r >r 3array r> swap first3 r> JNIEnv-functions JNINativeInterface-CallObjectMethod (call1) ;

View File

@ -11,8 +11,8 @@ IN: ldap.libldap
<< "libldap" { << "libldap" {
{ [ win32? ] [ "libldap.dll" "stdcall" ] } { [ win32? ] [ "libldap.dll" "stdcall" ] }
{ [ macosx? ] [ "libldap.dylib" "cdecl" ] } { [ macosx? ] [ "libldap.dylib" cdecl ] }
{ [ unix? ] [ "libldap.so" "cdecl" ] } { [ unix? ] [ "libldap.so" cdecl ] }
} cond add-library >> } cond add-library >>
: LDAP_VERSION1 1 ; inline : LDAP_VERSION1 1 ; inline

View File

@ -52,7 +52,7 @@ SYMBOL: def-hash-keys
[ t ] [ f ] [ t ] [ f ]
[ { } ] [ { } ]
[ drop f ] [ drop f ]
[ "cdecl" ] [ cdecl ]
[ first ] [ second ] [ third ] [ fourth ] [ first ] [ second ] [ third ] [ fourth ]
[ ">" write ] [ "/>" write ] [ ">" write ] [ "/>" write ]
} ; } ;

View File

@ -13,8 +13,8 @@ IN: oracle.liboci
"oci" { "oci" {
{ [ os winnt? ] [ "oci.dll" "stdcall" ] } { [ os winnt? ] [ "oci.dll" "stdcall" ] }
{ [ os macosx? ] [ "$DYLD_LIBRARY_PATH/libclntsh.dylib" "cdecl" ] } { [ os macosx? ] [ "$DYLD_LIBRARY_PATH/libclntsh.dylib" cdecl ] }
{ [ os unix? ] [ "$DYLD_LIBRARY_PATH/libclntsh.so.10.1" "cdecl" ] } { [ os unix? ] [ "$DYLD_LIBRARY_PATH/libclntsh.so.10.1" cdecl ] }
} cond add-library } cond add-library
! =============================================== ! ===============================================

View File

@ -11,8 +11,8 @@ IN: pdf.libhpdf
<< "libhpdf" { << "libhpdf" {
{ [ win32? ] [ "libhpdf.dll" "stdcall" ] } { [ win32? ] [ "libhpdf.dll" "stdcall" ] }
{ [ macosx? ] [ "libhpdf.dylib" "cdecl" ] } { [ macosx? ] [ "libhpdf.dylib" cdecl ] }
{ [ unix? ] [ "$LD_LIBRARY_PATH/libhpdf.so" "cdecl" ] } { [ unix? ] [ "$LD_LIBRARY_PATH/libhpdf.so" cdecl ] }
} cond add-library >> } cond add-library >>
! compression mode ! compression mode