From 1f57dc326e3475cfaf0bc7db859b1df844ea2b86 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 20 Oct 2010 17:42:53 -0500 Subject: [PATCH] Remove many uses of and *int etc --- basis/alien/c-types/c-types-docs.factor | 36 ++----------- basis/alien/c-types/c-types-tests.factor | 19 +++---- basis/alien/c-types/c-types.factor | 25 ++++++---- basis/alien/fortran/fortran-tests.factor | 12 ++--- basis/alien/fortran/fortran.factor | 50 ++++++++++--------- basis/compiler/tests/codegen.factor | 3 +- basis/compiler/tests/intrinsics.factor | 31 ++++++------ .../tree/cleanup/cleanup-tests.factor | 8 +-- basis/core-foundation/numbers/numbers.factor | 8 +-- basis/endian/endian.factor | 2 +- basis/game/input/dinput/dinput.factor | 4 +- basis/io/backend/unix/unix.factor | 8 +-- basis/io/files/windows/windows.factor | 6 +-- basis/io/monitors/windows/windows.factor | 2 +- basis/io/sockets/sockets.factor | 4 +- basis/io/sockets/unix/unix.factor | 10 ++-- basis/io/sockets/windows/windows.factor | 12 ++--- basis/opengl/opengl.factor | 2 +- basis/opengl/shaders/shaders.factor | 6 +-- basis/random/random.factor | 4 +- .../specialized-arrays-docs.factor | 2 +- basis/system-info/macosx/macosx.factor | 8 +-- basis/system-info/windows/windows.factor | 4 +- basis/ui/backend/cocoa/cocoa.factor | 2 +- basis/ui/backend/cocoa/views/views.factor | 2 +- basis/ui/backend/windows/windows.factor | 4 +- basis/unix/groups/groups.factor | 6 +-- basis/unix/types/netbsd/netbsd.factor | 2 +- basis/unix/types/openbsd/openbsd.factor | 2 +- basis/windows/registry/registry.factor | 28 +++++------ basis/x11/clipboard/clipboard.factor | 4 +- basis/x11/xim/xim.factor | 2 +- basis/x11/xinput2/xinput2.factor | 2 +- .../cxx/demangle/libstdcxx/libstdcxx.factor | 6 +-- extra/cuda/contexts/contexts.factor | 2 +- extra/cuda/devices/devices.factor | 11 ++-- extra/cuda/gl/gl.factor | 2 +- extra/ecdsa/ecdsa.factor | 4 +- extra/gpu/buffers/buffers.factor | 2 +- extra/gpu/framebuffers/framebuffers.factor | 3 +- extra/gpu/shaders/shaders.factor | 2 +- extra/gpu/state/state.factor | 6 +-- extra/openal/alut/macosx/macosx.factor | 4 +- extra/openal/alut/other/other.factor | 9 ++-- extra/openal/openal.factor | 4 +- extra/opencl/ffi/ffi-tests.factor | 18 +++---- extra/opencl/opencl-tests.factor | 2 +- extra/opencl/opencl.factor | 32 ++++++------ .../tokyo/assoc-functor/assoc-functor.factor | 4 +- 49 files changed, 209 insertions(+), 222 deletions(-) diff --git a/basis/alien/c-types/c-types-docs.factor b/basis/alien/c-types/c-types-docs.factor index 32c1d18d51..8643ae8072 100644 --- a/basis/alien/c-types/c-types-docs.factor +++ b/basis/alien/c-types/c-types-docs.factor @@ -121,38 +121,10 @@ $nl ARTICLE: "c-out-params" "Output parameters in C" "A frequently-occurring idiom in C code is the \"out parameter\". If a C function returns more than one value, the caller passes pointers of the correct type, and the C function writes its return values to those locations." $nl -"Each numerical C type, together with " { $snippet "void*" } ", has an associated " { $emphasis "out parameter constructor" } " word which takes a Factor object as input, constructs a byte array of the correct size, and converts the Factor object to a C value stored into the byte array:" -{ $subsections - - - - - - - - - - - - - -} -"You call the out parameter constructor with the required initial value, then pass the byte array to the C function, which receives a pointer to the start of the byte array's data area. The C function then returns, leaving the result in the byte array; you read it back using the next set of words:" -{ $subsections - *char - *uchar - *short - *ushort - *int - *uint - *long - *ulong - *longlong - *ulonglong - *float - *double - *void* -} +"To wrap Factor data for consumption by the FFI, we use a utility word that constructs a byte array of the correct size and converts the Factor object to a C value stored into that byte array:" +{ $subsections } +"You call the out parameter constructor with the required initial value, then pass the byte array to the C function, which receives a pointer to the start of the byte array's data area. The C function then returns, leaving the result in the byte array; you read it back using this word:" +{ $subsections deref } "Note that while structure and union types do not get these words defined for them, there is no loss of generality since " { $link } " and " { $link *void* } " may be used." ; ARTICLE: "c-types.primitives" "Primitive C types" diff --git a/basis/alien/c-types/c-types-tests.factor b/basis/alien/c-types/c-types-tests.factor index 96976b7b6c..7125f24d41 100644 --- a/basis/alien/c-types/c-types-tests.factor +++ b/basis/alien/c-types/c-types-tests.factor @@ -2,24 +2,25 @@ USING: alien alien.syntax alien.c-types alien.parser eval kernel tools.test sequences system libc alien.strings io.encodings.ascii io.encodings.utf8 math.constants classes.struct classes accessors compiler.units ; +FROM: alien.c-types => short ; IN: alien.c-types.tests CONSTANT: xyz 123 [ 492 ] [ { int xyz } heap-size ] unit-test -[ -1 ] [ -1 *char ] unit-test -[ -1 ] [ -1 *short ] unit-test -[ -1 ] [ -1 *int ] unit-test +[ -1 ] [ -1 char char deref ] unit-test +[ -1 ] [ -1 short short deref ] unit-test +[ -1 ] [ -1 int int deref ] unit-test ! I don't care if this throws an error or works, but at least ! it should be consistent between platforms -[ -1 ] [ -1.0 *int ] unit-test -[ -1 ] [ -1.0 *long ] unit-test -[ -1 ] [ -1.0 *longlong ] unit-test -[ 1 ] [ 1.0 *uint ] unit-test -[ 1 ] [ 1.0 *ulong ] unit-test -[ 1 ] [ 1.0 *ulonglong ] unit-test +[ -1 ] [ -1.0 int int deref ] unit-test +[ -1 ] [ -1.0 long long deref ] unit-test +[ -1 ] [ -1.0 longlong longlong deref ] unit-test +[ 1 ] [ 1.0 uint uint deref ] unit-test +[ 1 ] [ 1.0 ulong ulong deref ] unit-test +[ 1 ] [ 1.0 ulonglong ulonglong deref ] unit-test UNION-STRUCT: foo { a int } diff --git a/basis/alien/c-types/c-types.factor b/basis/alien/c-types/c-types.factor index f703f0d0f7..1bef9ea273 100644 --- a/basis/alien/c-types/c-types.factor +++ b/basis/alien/c-types/c-types.factor @@ -1,12 +1,9 @@ ! Copyright (C) 2004, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: byte-arrays arrays assocs delegate kernel kernel.private math -math.order math.parser namespaces make parser sequences strings -words splitting 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 words.symbol macros ; +USING: accessors alien alien.accessors arrays byte-arrays +classes combinators compiler.units cpu.architecture delegate +fry kernel layouts locals macros math math.order quotations +sequences system words words.symbol ; QUALIFIED: math IN: alien.c-types @@ -21,8 +18,8 @@ SYMBOLS: SINGLETON: void -DEFER: -DEFER: *char +DEFER: +DEFER: deref TUPLE: abstract-c-type { class class initial: object } @@ -111,7 +108,7 @@ M: c-type-name base-type c-type ; M: c-type base-type ; -: little-endian? ( -- ? ) 1 *char 1 = ; foldable +: little-endian? ( -- ? ) 1 int char deref 1 = ; foldable GENERIC: heap-size ( name -- size ) @@ -489,3 +486,11 @@ M: double-2-rep rep-component-type drop double ; : c-type-clamp ( value c-type -- value' ) dup { float double } member-eq? [ drop ] [ c-type-interval clamp ] if ; inline + +:: ( value c-type -- c-ptr ) + c-type heap-size :> c-ptr + value c-ptr 0 c-type set-alien-value + c-ptr ; inline + +: deref ( c-ptr c-type -- value ) + [ 0 ] dip alien-value ; inline diff --git a/basis/alien/fortran/fortran-tests.factor b/basis/alien/fortran/fortran-tests.factor index dc0585cab8..38e0d5f27a 100644 --- a/basis/alien/fortran/fortran-tests.factor +++ b/basis/alien/fortran/fortran-tests.factor @@ -192,10 +192,10 @@ intel-unix-abi fortran-abi [ { [ { [ ascii string>alien ] - [ ] - [ ] + [ longlong ] + [ float ] [ ] - [ 1 0 ? ] + [ 1 0 ? c:short ] } spread ] [ { [ length ] [ drop ] [ drop ] [ drop ] [ drop ] } spread ] } 5 ncleave @@ -211,7 +211,7 @@ intel-unix-abi fortran-abi [ [ drop ] [ drop ] [ drop ] - [ *float ] + [ float deref ] [ drop ] [ drop ] } spread @@ -280,7 +280,7 @@ intel-unix-abi fortran-abi [ { [ { [ ascii string>alien ] - [ ] + [ float ] [ ascii string>alien ] } spread ] [ { [ length ] [ drop ] [ length ] } spread ] @@ -298,7 +298,7 @@ intel-unix-abi fortran-abi [ [ ascii alien>nstring ] [ ] [ ascii alien>nstring ] - [ *float ] + [ float deref ] [ ] [ ascii alien>nstring ] } spread diff --git a/basis/alien/fortran/fortran.factor b/basis/alien/fortran/fortran.factor index 3d87431084..4b7142c435 100755 --- a/basis/alien/fortran/fortran.factor +++ b/basis/alien/fortran/fortran.factor @@ -1,5 +1,5 @@ ! (c) 2009 Joe Groff, see BSD license -USING: accessors alien alien.c-types alien.complex alien.data +USING: accessors alien alien.complex alien.c-types alien.data alien.parser grouping alien.strings alien.syntax arrays ascii assocs byte-arrays combinators combinators.short-circuit fry generalizations kernel lexer macros math math.parser namespaces @@ -211,11 +211,11 @@ GENERIC: (fortran-arg>c-args) ( type -- main-quot added-quot ) M: integer-type (fortran-arg>c-args) [ size>> { - { f [ [ ] [ drop ] ] } - { 1 [ [ ] [ drop ] ] } - { 2 [ [ ] [ drop ] ] } - { 4 [ [ ] [ drop ] ] } - { 8 [ [ ] [ drop ] ] } + { f [ [ c:int ] [ drop ] ] } + { 1 [ [ c:char ] [ drop ] ] } + { 2 [ [ c:short ] [ drop ] ] } + { 4 [ [ c:int ] [ drop ] ] } + { 8 [ [ c:longlong ] [ drop ] ] } [ invalid-fortran-type ] } case ] args?dims ; @@ -226,9 +226,9 @@ M: logical-type (fortran-arg>c-args) M: real-type (fortran-arg>c-args) [ size>> { - { f [ [ ] [ drop ] ] } - { 4 [ [ ] [ drop ] ] } - { 8 [ [ ] [ drop ] ] } + { f [ [ c:float ] [ drop ] ] } + { 4 [ [ c:float ] [ drop ] ] } + { 8 [ [ c:double ] [ drop ] ] } [ invalid-fortran-type ] } case ] args?dims ; @@ -244,14 +244,14 @@ M: real-complex-type (fortran-arg>c-args) ] args?dims ; M: double-precision-type (fortran-arg>c-args) - [ drop [ ] [ drop ] ] args?dims ; + [ drop [ c:double ] [ drop ] ] args?dims ; M: double-complex-type (fortran-arg>c-args) [ drop [ ] [ drop ] ] args?dims ; M: character-type (fortran-arg>c-args) fix-character-type single-char? - [ [ first ] [ drop ] ] + [ [ first c:char ] [ drop ] ] [ [ ascii string>alien ] [ length ] ] if ; M: misc-type (fortran-arg>c-args) @@ -263,23 +263,25 @@ GENERIC: (fortran-result>) ( type -- quots ) [ dup dims>> [ drop { [ ] } ] ] dip if ; inline M: integer-type (fortran-result>) - [ size>> { - { f [ { [ *int ] } ] } - { 1 [ { [ *char ] } ] } - { 2 [ { [ *short ] } ] } - { 4 [ { [ *int ] } ] } - { 8 [ { [ *longlong ] } ] } - [ invalid-fortran-type ] - } case ] result?dims ; + [ + size>> { + { f [ { [ c:int deref ] } ] } + { 1 [ { [ c:char deref ] } ] } + { 2 [ { [ c:short deref ] } ] } + { 4 [ { [ c:int deref ] } ] } + { 8 [ { [ c:longlong deref ] } ] } + [ invalid-fortran-type ] + } case + ] result?dims ; M: logical-type (fortran-result>) [ call-next-method first [ zero? not ] append 1array ] result?dims ; M: real-type (fortran-result>) [ size>> { - { f [ { [ *float ] } ] } - { 4 [ { [ *float ] } ] } - { 8 [ { [ *double ] } ] } + { f [ { [ c:float deref ] } ] } + { 4 [ { [ c:float deref ] } ] } + { 8 [ { [ c:double deref ] } ] } [ invalid-fortran-type ] } case ] result?dims ; @@ -292,14 +294,14 @@ M: real-complex-type (fortran-result>) } case ] result?dims ; M: double-precision-type (fortran-result>) - [ drop { [ *double ] } ] result?dims ; + [ drop { [ c:double deref ] } ] result?dims ; M: double-complex-type (fortran-result>) [ drop { [ *complex-double ] } ] result?dims ; M: character-type (fortran-result>) fix-character-type single-char? - [ { [ *char 1string ] } ] + [ { [ c:char deref 1string ] } ] [ { [ ] [ ascii alien>nstring ] } ] if ; M: misc-type (fortran-result>) diff --git a/basis/compiler/tests/codegen.factor b/basis/compiler/tests/codegen.factor index 4c4e8de94d..4e822ba32c 100644 --- a/basis/compiler/tests/codegen.factor +++ b/basis/compiler/tests/codegen.factor @@ -275,7 +275,8 @@ M: cucumber equal? "The cucumber has no equal" throw ; [ 4294967295 B{ 255 255 255 255 } -1 ] [ - -1 -1 + -1 int + -1 int [ [ 0 alien-unsigned-4 swap ] [ 0 alien-signed-2 ] bi ] compile-call ] unit-test diff --git a/basis/compiler/tests/intrinsics.factor b/basis/compiler/tests/intrinsics.factor index 53017ff452..b217d1b57e 100644 --- a/basis/compiler/tests/intrinsics.factor +++ b/basis/compiler/tests/intrinsics.factor @@ -6,6 +6,7 @@ sbufs strings.private slots.private alien math.order alien.accessors alien.c-types alien.data alien.syntax alien.strings namespaces libc io.encodings.ascii classes compiler.test ; FROM: math => float ; +FROM: alien.c-types => short ; IN: compiler.tests.intrinsics ! Make sure that intrinsic ops compile to correct code. @@ -442,31 +443,31 @@ ERROR: bug-in-fixnum* x y a b ; [ 252 ] [ B{ 1 2 3 -4 5 } 3 [ { byte-array fixnum } declare alien-unsigned-1 ] compile-call ] unit-test [ -4 ] [ B{ 1 2 3 -4 5 } 3 [ { byte-array fixnum } declare alien-signed-1 ] compile-call ] unit-test -[ -100 ] [ -100 [ { byte-array } declare *char ] compile-call ] unit-test -[ 156 ] [ -100 [ { byte-array } declare *uchar ] compile-call ] unit-test +[ -100 ] [ -100 char [ { byte-array } declare char deref ] compile-call ] unit-test +[ 156 ] [ -100 uchar [ { byte-array } declare uchar deref ] compile-call ] unit-test -[ -100 ] [ -100 \ def>> [ { fixnum } declare ] prepend compile-call *char ] unit-test -[ 156 ] [ -100 \ def>> [ { fixnum } declare ] prepend compile-call *uchar ] unit-test +[ -100 ] [ -100 \ def>> [ { fixnum } declare ] prepend compile-call char deref ] unit-test +[ 156 ] [ -100 \ def>> [ { fixnum } declare ] prepend compile-call uchar deref ] unit-test -[ -1000 ] [ -1000 [ { byte-array } declare *short ] compile-call ] unit-test -[ 64536 ] [ -1000 [ { byte-array } declare *ushort ] compile-call ] unit-test +[ -1000 ] [ -1000 short [ { byte-array } declare short deref ] compile-call ] unit-test +[ 64536 ] [ -1000 ushort [ { byte-array } declare ushort deref ] compile-call ] unit-test -[ -1000 ] [ -1000 \ def>> [ { fixnum } declare ] prepend compile-call *short ] unit-test -[ 64536 ] [ -1000 \ def>> [ { fixnum } declare ] prepend compile-call *ushort ] unit-test +[ -1000 ] [ -1000 \ def>> [ { fixnum } declare ] prepend compile-call short deref ] unit-test +[ 64536 ] [ -1000 \ def>> [ { fixnum } declare ] prepend compile-call ushort deref ] unit-test -[ -100000 ] [ -100000 [ { byte-array } declare *int ] compile-call ] unit-test -[ 4294867296 ] [ -100000 [ { byte-array } declare *uint ] compile-call ] unit-test +[ -100000 ] [ -100000 int [ { byte-array } declare int deref ] compile-call ] unit-test +[ 4294867296 ] [ -100000 uint [ { byte-array } declare uint deref ] compile-call ] unit-test -[ -100000 ] [ -100000 \ def>> [ { fixnum } declare ] prepend compile-call *int ] unit-test -[ 4294867296 ] [ -100000 \ def>> [ { fixnum } declare ] prepend compile-call *uint ] unit-test +[ -100000 ] [ -100000 \ def>> [ { fixnum } declare ] prepend compile-call int deref ] unit-test +[ 4294867296 ] [ -100000 \ def>> [ { fixnum } declare ] prepend compile-call uint deref ] unit-test -[ t ] [ pi pi *double = ] unit-test +[ t ] [ pi pi double double deref = ] unit-test -[ t ] [ pi [ { byte-array } declare *double ] compile-call pi = ] unit-test +[ t ] [ pi double [ { byte-array } declare double deref ] compile-call pi = ] unit-test ! Silly [ t ] [ pi 4 [ [ { float byte-array } declare 0 set-alien-float ] compile-call ] keep *float pi - -0.001 0.001 between? ] unit-test -[ t ] [ pi [ { byte-array } declare *float ] compile-call pi - -0.001 0.001 between? ] unit-test +[ t ] [ pi float [ { byte-array } declare float deref ] compile-call pi - -0.001 0.001 between? ] unit-test [ t ] [ pi 8 [ [ { float byte-array } declare 0 set-alien-double ] compile-call ] keep *double pi = ] unit-test diff --git a/basis/compiler/tree/cleanup/cleanup-tests.factor b/basis/compiler/tree/cleanup/cleanup-tests.factor index 88e7895c89..46255d9fbc 100644 --- a/basis/compiler/tree/cleanup/cleanup-tests.factor +++ b/basis/compiler/tree/cleanup/cleanup-tests.factor @@ -244,22 +244,22 @@ cell-bits 32 = [ ] when [ t ] [ - [ B{ 1 0 } *short 0 number= ] + [ B{ 1 0 } short deref 0 number= ] \ number= inlined? ] unit-test [ t ] [ - [ B{ 1 0 } *short 0 { number number } declare number= ] + [ B{ 1 0 } short deref 0 { number number } declare number= ] \ number= inlined? ] unit-test [ t ] [ - [ B{ 1 0 } *short 0 = ] + [ B{ 1 0 } short deref 0 = ] \ number= inlined? ] unit-test [ t ] [ - [ B{ 1 0 } *short dup number? [ 0 number= ] [ drop f ] if ] + [ B{ 1 0 } short deref dup number? [ 0 number= ] [ drop f ] if ] \ number= inlined? ] unit-test diff --git a/basis/core-foundation/numbers/numbers.factor b/basis/core-foundation/numbers/numbers.factor index ae061cb4eb..4d9f4e8d9f 100644 --- a/basis/core-foundation/numbers/numbers.factor +++ b/basis/core-foundation/numbers/numbers.factor @@ -30,14 +30,14 @@ FUNCTION: CFNumberRef CFNumberCreate ( CFAllocatorRef allocator, CFNumberType th GENERIC: ( number -- alien ) M: integer - [ f kCFNumberLongLongType ] dip CFNumberCreate ; + [ f kCFNumberLongLongType ] dip longlong CFNumberCreate ; M: float - [ f kCFNumberDoubleType ] dip CFNumberCreate ; + [ f kCFNumberDoubleType ] dip double CFNumberCreate ; M: t - drop f kCFNumberIntType 1 CFNumberCreate ; + drop f kCFNumberIntType 1 int CFNumberCreate ; M: f - drop f kCFNumberIntType 0 CFNumberCreate ; + drop f kCFNumberIntType 0 int CFNumberCreate ; diff --git a/basis/endian/endian.factor b/basis/endian/endian.factor index 4928458543..502b130265 100644 --- a/basis/endian/endian.factor +++ b/basis/endian/endian.factor @@ -7,7 +7,7 @@ IN: endian SINGLETONS: big-endian little-endian ; : compute-native-endianness ( -- class ) - 1 *char 0 = big-endian little-endian ? ; + 1 int char deref 0 = big-endian little-endian ? ; SYMBOL: native-endianness native-endianness [ compute-native-endianness ] initialize diff --git a/basis/game/input/dinput/dinput.factor b/basis/game/input/dinput/dinput.factor index f5b3520b12..61216fb317 100755 --- a/basis/game/input/dinput/dinput.factor +++ b/basis/game/input/dinput/dinput.factor @@ -303,8 +303,8 @@ CONSTANT: pov-values } 2cleave ; : read-device-buffer ( device buffer count -- buffer count' ) - [ DIDEVICEOBJECTDATA heap-size ] 2dip - [ 0 IDirectInputDevice8W::GetDeviceData ole32-error ] 2keep *uint ; + [ DIDEVICEOBJECTDATA heap-size ] 2dip uint + [ 0 IDirectInputDevice8W::GetDeviceData ole32-error ] 2keep uint deref ; : (fill-mouse-state) ( state DIDEVICEOBJECTDATA -- state ) [ dwData>> 32 >signed ] [ dwOfs>> ] bi { diff --git a/basis/io/backend/unix/unix.factor b/basis/io/backend/unix/unix.factor index fd9fed0472..e84f1a8825 100755 --- a/basis/io/backend/unix/unix.factor +++ b/basis/io/backend/unix/unix.factor @@ -146,7 +146,7 @@ M: stdin dispose* : wait-for-stdin ( stdin -- size ) [ control>> CHAR: X over io:stream-write1 io:stream-flush ] - [ size>> ssize_t heap-size swap io:stream-read *int ] + [ size>> ssize_t heap-size swap io:stream-read int deref ] bi ; :: refill-stdin ( buffer stdin size -- ) @@ -167,11 +167,11 @@ M: stdin refill M: stdin cancel-operation [ size>> ] [ control>> ] bi [ cancel-operation ] bi@ ; -: control-write-fd ( -- fd ) &: control_write *uint ; +: control-write-fd ( -- fd ) &: control_write uint deref ; -: size-read-fd ( -- fd ) &: size_read *uint ; +: size-read-fd ( -- fd ) &: size_read uint deref ; -: data-read-fd ( -- fd ) &: stdin_read *uint ; +: data-read-fd ( -- fd ) &: stdin_read uint deref ; : ( -- stdin ) stdin new-disposable diff --git a/basis/io/files/windows/windows.factor b/basis/io/files/windows/windows.factor index 024b278b4b..70fe03b290 100644 --- a/basis/io/files/windows/windows.factor +++ b/basis/io/files/windows/windows.factor @@ -131,7 +131,7 @@ M: winnt init-io ( -- ) ERROR: invalid-file-size n ; : handle>file-size ( handle -- n ) - 0 [ GetFileSizeEx win32-error=0/f ] keep *ulonglong ; + 0 ulonglong [ GetFileSizeEx win32-error=0/f ] keep ulonglong deref ; ERROR: seek-before-start n ; @@ -249,7 +249,7 @@ M: winnt init-stdio GetLastError ERROR_ALREADY_EXISTS = not ; : set-file-pointer ( handle length method -- ) - [ [ handle>> ] dip d>w/w ] dip SetFilePointer + [ [ handle>> ] dip d>w/w uint ] dip SetFilePointer INVALID_SET_FILE_POINTER = [ "SetFilePointer failed" throw ] when ; M: windows (file-reader) ( path -- stream ) @@ -350,4 +350,4 @@ M: winnt home [ "HOMEDRIVE" os-env "HOMEPATH" os-env append-path ] [ "USERPROFILE" os-env ] [ my-documents ] - } 0|| ; \ No newline at end of file + } 0|| ; diff --git a/basis/io/monitors/windows/windows.factor b/basis/io/monitors/windows/windows.factor index 8887d718d1..43b3ac7ef4 100644 --- a/basis/io/monitors/windows/windows.factor +++ b/basis/io/monitors/windows/windows.factor @@ -32,7 +32,7 @@ TUPLE: win32-monitor < monitor port ; [ recursive>> 1 0 ? ] } cleave FILE_NOTIFY_CHANGE_ALL - 0 + 0 uint (make-overlapped) [ f ReadDirectoryChangesW win32-error=0/f ] keep ; diff --git a/basis/io/sockets/sockets.factor b/basis/io/sockets/sockets.factor index 2a7391c36b..a1bfd4c6aa 100644 --- a/basis/io/sockets/sockets.factor +++ b/basis/io/sockets/sockets.factor @@ -106,10 +106,10 @@ M: ipv4 make-sockaddr ( inet -- sockaddr ) swap [ port>> htons >>port ] [ host>> "0.0.0.0" or ] - [ inet-pton *uint >>addr ] tri ; + [ inet-pton uint deref >>addr ] tri ; M: ipv4 parse-sockaddr ( sockaddr-in addrspec -- newaddrspec ) - [ addr>> ] dip inet-ntop ; + [ addr>> uint ] dip inet-ntop ; TUPLE: inet4 < ipv4 { port integer read-only } ; diff --git a/basis/io/sockets/unix/unix.factor b/basis/io/sockets/unix/unix.factor index 4d6c699211..3f91c0e8b6 100644 --- a/basis/io/sockets/unix/unix.factor +++ b/basis/io/sockets/unix/unix.factor @@ -16,7 +16,7 @@ IN: io.sockets.unix socket dup io-error init-fd |dispose ; : set-socket-option ( fd level opt -- ) - [ handle-fd ] 2dip 1 dup byte-length setsockopt io-error ; + [ handle-fd ] 2dip 1 int dup byte-length setsockopt io-error ; M: unix addrinfo-error ( n -- ) [ gai_strerror throw ] unless-zero ; @@ -39,11 +39,11 @@ M: unix addrspec-of-family ( af -- addrspec ) ! Client sockets - TCP and Unix domain M: object (get-local-address) ( handle remote -- sockaddr ) - [ handle-fd ] dip empty-sockaddr/size + [ handle-fd ] dip empty-sockaddr/size int [ getsockname io-error ] 2keep drop ; M: object (get-remote-address) ( handle local -- sockaddr ) - [ handle-fd ] dip empty-sockaddr/size + [ handle-fd ] dip empty-sockaddr/size int [ getpeername io-error ] 2keep drop ; : init-client-socket ( fd -- ) @@ -101,7 +101,7 @@ M: object (server) ( addrspec -- handle ) ] with-destructors ; : do-accept ( server addrspec -- fd sockaddr ) - [ handle>> handle-fd ] [ empty-sockaddr/size ] bi* + [ handle>> handle-fd ] [ empty-sockaddr/size int ] bi* [ accept ] 2keep drop ; inline M: object (accept) ( server addrspec -- fd sockaddr ) @@ -138,7 +138,7 @@ CONSTANT: packet-size 65536 packet-size ! nbytes 0 ! flags sockaddr ! from - len ! fromlen + len int ! fromlen recvfrom dup 0 >= [ receive-buffer get-global swap memory>byte-array sockaddr ] [ drop f f ] diff --git a/basis/io/sockets/windows/windows.factor b/basis/io/sockets/windows/windows.factor index 157aa5c848..ec82631f70 100755 --- a/basis/io/sockets/windows/windows.factor +++ b/basis/io/sockets/windows/windows.factor @@ -48,11 +48,11 @@ M: win32-socket dispose* ( stream -- ) opened-socket ; M: object (get-local-address) ( socket addrspec -- sockaddr ) - [ handle>> ] dip empty-sockaddr/size + [ handle>> ] dip empty-sockaddr/size int [ getsockname socket-error ] 2keep drop ; M: object (get-remote-address) ( socket addrspec -- sockaddr ) - [ handle>> ] dip empty-sockaddr/size + [ handle>> ] dip empty-sockaddr/size int [ getpeername socket-error ] 2keep drop ; : bind-socket ( win32-socket sockaddr len -- ) @@ -87,7 +87,7 @@ M: windows (raw) ( addrspec -- handle ) [ SOCK_RAW server-socket ] with-destructors ; : malloc-int ( n -- alien ) - malloc-byte-array ; inline + int malloc-byte-array ; inline M: winnt WSASocket-flags ( -- DWORD ) WSA_FLAG_OVERLAPPED ; @@ -181,7 +181,7 @@ TUPLE: AcceptEx-args port } cleave AcceptEx drop winsock-error ; inline : (extract-remote-address) ( lpOutputBuffer dwReceiveDataLength dwLocalAddressLength dwRemoteAddressLength -- sockaddr ) - f 0 f [ 0 GetAcceptExSockaddrs ] keep *void* ; + f 0 int f [ 0 int GetAcceptExSockaddrs ] keep *void* ; : extract-remote-address ( AcceptEx -- sockaddr ) [ @@ -246,7 +246,7 @@ TUPLE: WSARecvFrom-args port [ [ port>> addr>> empty-sockaddr dup ] [ lpFrom>> ] - [ lpFromLen>> *int ] + [ lpFromLen>> int deref ] tri memcpy ] bi ; inline @@ -278,7 +278,7 @@ TUPLE: WSASendTo-args port swap make-send-buffer >>lpBuffers 1 >>dwBufferCount 0 >>dwFlags - 0 >>lpNumberOfBytesSent + 0 uint >>lpNumberOfBytesSent (make-overlapped) >>lpOverlapped ; inline : call-WSASendTo ( WSASendTo -- ) diff --git a/basis/opengl/opengl.factor b/basis/opengl/opengl.factor index fda840b281..0589e0eede 100644 --- a/basis/opengl/opengl.factor +++ b/basis/opengl/opengl.factor @@ -142,7 +142,7 @@ MACRO: all-enabled-client-state ( seq quot -- ) [ 1 { uint } ] dip with-out-parameters ; inline : (delete-gl-object) ( id quot -- ) - [ 1 swap ] dip call ; inline + [ 1 swap uint ] dip call ; inline : gen-gl-buffer ( -- id ) [ glGenBuffers ] (gen-gl-object) ; diff --git a/basis/opengl/shaders/shaders.factor b/basis/opengl/shaders/shaders.factor index 720665a1b8..76a9f96933 100644 --- a/basis/opengl/shaders/shaders.factor +++ b/basis/opengl/shaders/shaders.factor @@ -47,7 +47,7 @@ IN: opengl.shaders : gl-shader-info-log ( shader -- log ) dup gl-shader-info-log-length dup [ 1 calloc &free - [ 0 swap glGetShaderInfoLog ] keep + [ 0 int swap glGetShaderInfoLog ] keep ascii alien>string ] with-destructors ; @@ -90,7 +90,7 @@ PREDICATE: fragment-shader < gl-shader (fragment-shader?) ; : gl-program-info-log ( program -- log ) dup gl-program-info-log-length dup [ 1 calloc &free - [ 0 swap glGetProgramInfoLog ] keep + [ 0 int swap glGetProgramInfoLog ] keep ascii alien>string ] with-destructors ; @@ -107,7 +107,7 @@ PREDICATE: fragment-shader < gl-shader (fragment-shader?) ; : gl-program-shaders ( program -- shaders ) dup gl-program-shaders-length 2 * - 0 + 0 int over [ glGetAttachedShaders ] keep [ zero? not ] filter ; diff --git a/basis/random/random.factor b/basis/random/random.factor index ba5d9c7ca3..ae7c0ad1e3 100644 --- a/basis/random/random.factor +++ b/basis/random/random.factor @@ -90,8 +90,8 @@ ERROR: too-many-samples seq n ; secure-random-generator get swap with-random ; inline : uniform-random-float ( min max -- n ) - 4 random-bytes underlying>> *uint >float - 4 random-bytes underlying>> *uint >float + 4 random-bytes underlying>> uint deref >float + 4 random-bytes underlying>> uint deref >float 2.0 32 ^ * + [ over - 2.0 -64 ^ * ] dip * + ; inline diff --git a/basis/specialized-arrays/specialized-arrays-docs.factor b/basis/specialized-arrays/specialized-arrays-docs.factor index b476a47072..722dff6d91 100644 --- a/basis/specialized-arrays/specialized-arrays-docs.factor +++ b/basis/specialized-arrays/specialized-arrays-docs.factor @@ -94,7 +94,7 @@ $nl "" "FUNCTION: void get_device_info ( int* length ) ;" "" - "0 [ get_device_info ] keep ." + "0 int [ get_device_info ] keep ." } "For a full discussion of Factor heap allocation versus unmanaged memory allocation, see " { $link "byte-arrays-gc" } "." $nl diff --git a/basis/system-info/macosx/macosx.factor b/basis/system-info/macosx/macosx.factor index b51fd52995..11a89fc4bd 100644 --- a/basis/system-info/macosx/macosx.factor +++ b/basis/system-info/macosx/macosx.factor @@ -11,23 +11,23 @@ LIBRARY: libc FUNCTION: int sysctl ( int* name, uint namelen, void* oldp, size_t* oldlenp, void* newp, size_t newlen ) ; : make-int-array ( seq -- byte-array ) - [ ] map concat ; + [ int ] map concat ; : (sysctl-query) ( name namelen oldp oldlenp -- oldp ) over [ f 0 sysctl io-error ] dip ; : sysctl-query ( seq n -- byte-array ) [ [ make-int-array ] [ length ] bi ] dip - [ ] [ ] bi (sysctl-query) ; + [ ] [ uint ] bi (sysctl-query) ; : sysctl-query-string ( seq -- n ) 4096 sysctl-query utf8 alien>string ; : sysctl-query-uint ( seq -- n ) - 4 sysctl-query *uint ; + 4 sysctl-query uint deref ; : sysctl-query-ulonglong ( seq -- n ) - 8 sysctl-query *ulonglong ; + 8 sysctl-query ulonglong deref ; : machine ( -- str ) { 6 1 } sysctl-query-string ; : model ( -- str ) { 6 2 } sysctl-query-string ; diff --git a/basis/system-info/windows/windows.factor b/basis/system-info/windows/windows.factor index 0aba5eeff1..5ea68dbbad 100644 --- a/basis/system-info/windows/windows.factor +++ b/basis/system-info/windows/windows.factor @@ -95,10 +95,10 @@ M: winnt available-virtual-mem ( -- n ) : computer-name ( -- string ) MAX_COMPUTERNAME_LENGTH 1 + - [ dup ] keep + [ dup ] keep uint GetComputerName win32-error=0/f alien>native-string ; : username ( -- string ) UNLEN 1 + - [ dup ] keep + [ dup ] keep uint GetUserName win32-error=0/f alien>native-string ; diff --git a/basis/ui/backend/cocoa/cocoa.factor b/basis/ui/backend/cocoa/cocoa.factor index 48647df92d..1e7777d9d7 100644 --- a/basis/ui/backend/cocoa/cocoa.factor +++ b/basis/ui/backend/cocoa/cocoa.factor @@ -128,7 +128,7 @@ CONSTANT: window-control>styleMask : make-context-transparent ( view -- ) -> openGLContext - 0 NSOpenGLCPSurfaceOpacity -> setValues:forParameter: ; + 0 int NSOpenGLCPSurfaceOpacity -> setValues:forParameter: ; M:: cocoa-ui-backend (open-window) ( world -- ) world [ [ dim>> ] dip ] diff --git a/basis/ui/backend/cocoa/views/views.factor b/basis/ui/backend/cocoa/views/views.factor index e98c31b295..7837402701 100644 --- a/basis/ui/backend/cocoa/views/views.factor +++ b/basis/ui/backend/cocoa/views/views.factor @@ -332,7 +332,7 @@ CLASS: FactorView < NSOpenGLView NSTextInput ] : sync-refresh-to-screen ( GLView -- ) - -> openGLContext -> CGLContextObj NSOpenGLCPSwapInterval 1 + -> openGLContext -> CGLContextObj NSOpenGLCPSwapInterval 1 int CGLSetParameter drop ; : ( dim pixel-format -- view ) diff --git a/basis/ui/backend/windows/windows.factor b/basis/ui/backend/windows/windows.factor index 5178dbb499..09ba203857 100755 --- a/basis/ui/backend/windows/windows.factor +++ b/basis/ui/backend/windows/windows.factor @@ -66,7 +66,7 @@ PIXEL-FORMAT-ATTRIBUTE-TABLE: WGL_ARB { $ WGL_SUPPORT_OPENGL_ARB 1 } H{ >WGL_ARB [ drop f ] [ [ [ world>> handle>> hDC>> ] [ handle>> ] bi 0 1 ] dip - first { int } + first int { int } [ wglGetPixelFormatAttribivARB win32-error=0/f ] with-out-parameters ] if-empty ; @@ -168,7 +168,7 @@ M: windows-ui-backend (pixel-format-attribute) PRIVATE> -: lo-word ( wparam -- lo ) *short ; inline +: lo-word ( wparam -- lo ) short short deref ; inline : hi-word ( wparam -- hi ) -16 shift lo-word ; inline : >lo-hi ( WORD -- array ) [ lo-word ] [ hi-word ] bi 2array ; : GET_APPCOMMAND_LPARAM ( lParam -- appCommand ) diff --git a/basis/unix/groups/groups.factor b/basis/unix/groups/groups.factor index 5da7c189ae..117b60d8f5 100644 --- a/basis/unix/groups/groups.factor +++ b/basis/unix/groups/groups.factor @@ -67,13 +67,13 @@ ERROR: no-group string ; groups ( byte-array n -- groups ) - [ 4 grouping:group ] dip head-slice [ *uint group-name ] map ; + [ 4 grouping:group ] dip head-slice [ uint deref group-name ] map ; : (user-groups) ( string -- seq ) #! first group is -1337, legacy unix code -1337 unix.ffi:NGROUPS_MAX [ 4 * ] keep - [ [ unix.ffi:getgrouplist ] unix-system-call drop ] 2keep - [ 4 tail-slice ] [ *int 1 - ] bi* >groups ; + int [ [ unix.ffi:getgrouplist ] unix-system-call drop ] 2keep + [ 4 tail-slice ] [ int deref 1 - ] bi* >groups ; PRIVATE> diff --git a/basis/unix/types/netbsd/netbsd.factor b/basis/unix/types/netbsd/netbsd.factor index 7dacc97061..00dd4bcb4a 100644 --- a/basis/unix/types/netbsd/netbsd.factor +++ b/basis/unix/types/netbsd/netbsd.factor @@ -17,7 +17,7 @@ TYPEDEF: long ssize_t TYPEDEF: int pid_t TYPEDEF: int time_t -ALIAS: +: ( n -- time_t ) int ; cell-bits { { 32 [ "unix.types.netbsd.32" require ] } diff --git a/basis/unix/types/openbsd/openbsd.factor b/basis/unix/types/openbsd/openbsd.factor index 7c8fbd2b9d..071cc4747e 100644 --- a/basis/unix/types/openbsd/openbsd.factor +++ b/basis/unix/types/openbsd/openbsd.factor @@ -18,4 +18,4 @@ TYPEDEF: long ssize_t TYPEDEF: int pid_t TYPEDEF: int time_t -ALIAS: \ No newline at end of file +: ( n -- time_t ) int ; diff --git a/basis/windows/registry/registry.factor b/basis/windows/registry/registry.factor index 25c80061b2..50b61dcf89 100644 --- a/basis/windows/registry/registry.factor +++ b/basis/windows/registry/registry.factor @@ -21,7 +21,7 @@ CONSTANT: registry-value-max-length 16384 [ key subkey mode ] dip n>win32-error-string open-key-failed ] if - ] keep *uint ; + ] keep uint deref ; :: create-key* ( hKey lpSubKey lpClass dwOptions samDesired lpSecurityAttributes -- hkey new? ) hKey lpSubKey 0 lpClass dwOptions samDesired lpSecurityAttributes @@ -29,8 +29,8 @@ CONSTANT: registry-value-max-length 16384 DWORD f :> ret! [ RegCreateKeyEx ret! ] 2keep - [ *uint ] - [ *uint REG_CREATED_NEW_KEY = ] bi* + [ uint deref ] + [ uint deref REG_CREATED_NEW_KEY = ] bi* ret ERROR_SUCCESS = [ [ hKey lpSubKey 0 lpClass dwOptions samDesired @@ -67,11 +67,11 @@ CONSTANT: registry-value-max-length 16384 length 2 * ; :: reg-query-value-ex ( key subkey ptr1 ptr2 buffer -- buffer ) - buffer length :> pdword + buffer length uint :> pdword key subkey ptr1 ptr2 buffer pdword [ RegQueryValueEx ] 2keep rot :> ret ret ERROR_SUCCESS = [ - *uint head + uint deref head ] [ ret ERROR_MORE_DATA = [ 2drop @@ -116,7 +116,7 @@ TUPLE: registry-enum-key ; key MAX_PATH dup TCHAR dup :> class-buffer - swap dup :> class-buffer-length + swap int dup :> class-buffer-length f DWORD dup :> sub-keys DWORD dup :> longest-subkey @@ -130,13 +130,13 @@ TUPLE: registry-enum-key ; ret ERROR_SUCCESS = [ key class-buffer - sub-keys *uint - longest-subkey *uint - longest-class-string *uint - #values *uint - max-value *uint - max-value-data *uint - security-descriptor *uint + sub-keys uint deref + longest-subkey uint deref + longest-class-string uint deref + #values uint deref + max-value uint deref + max-value-data uint deref + security-descriptor uint deref last-write-time FILETIME>timestamp registry-info boa ] [ @@ -191,4 +191,4 @@ PRIVATE> 21 2^ reg-query-value-ex ; : read-registry ( key subkey -- registry-info ) - KEY_READ [ reg-query-info-key ] with-open-registry-key ; \ No newline at end of file + KEY_READ [ reg-query-info-key ] with-open-registry-key ; diff --git a/basis/x11/clipboard/clipboard.factor b/basis/x11/clipboard/clipboard.factor index 496b9d688c..290c3e6aa3 100644 --- a/basis/x11/clipboard/clipboard.factor +++ b/basis/x11/clipboard/clipboard.factor @@ -32,7 +32,7 @@ TUPLE: x-clipboard atom contents ; : window-property ( win prop delete? -- string ) [ [ dpy get ] 2dip 0 -1 ] dip AnyPropertyType - 0 0 0 0 f + 0 0 int 0 0 f [ XGetWindowProperty drop ] keep snarf-property ; : selection-from-event ( event window -- string ) @@ -53,7 +53,7 @@ TUPLE: x-clipboard atom contents ; [ dpy get ] dip [ requestor>> ] [ property>> XA_TIMESTAMP 32 PropModeReplace ] - [ time>> ] tri + [ time>> int ] tri 1 XChangeProperty drop ; : send-notify ( evt prop -- ) diff --git a/basis/x11/xim/xim.factor b/basis/x11/xim/xim.factor index 06add388b1..d47672d598 100644 --- a/basis/x11/xim/xim.factor +++ b/basis/x11/xim/xim.factor @@ -51,7 +51,7 @@ SYMBOL: keysym : lookup-string ( event xic -- string keysym ) [ prepare-lookup - swap keybuf get buf-size keysym get 0 + swap keybuf get buf-size keysym get 0 int XwcLookupString finish-lookup ] with-scope ; diff --git a/basis/x11/xinput2/xinput2.factor b/basis/x11/xinput2/xinput2.factor index 80aaf95d63..1a6b0e3cf2 100644 --- a/basis/x11/xinput2/xinput2.factor +++ b/basis/x11/xinput2/xinput2.factor @@ -5,7 +5,7 @@ x11.constants x11.xinput2.ffi ; IN: x11.xinput2 : (xi2-available?) ( display -- ? ) - 2 0 [ ] bi@ + 2 0 [ int ] bi@ XIQueryVersion { { BadRequest [ f ] } diff --git a/extra/alien/cxx/demangle/libstdcxx/libstdcxx.factor b/extra/alien/cxx/demangle/libstdcxx/libstdcxx.factor index 403015bad5..522c33bbf1 100644 --- a/extra/alien/cxx/demangle/libstdcxx/libstdcxx.factor +++ b/extra/alien/cxx/demangle/libstdcxx/libstdcxx.factor @@ -22,9 +22,9 @@ ERROR: invalid-demangle-args name ; "_Z" head? ; :: demangle ( mangled-name -- c++-name ) - 0 :> length - 0 :> status [ + 0 ulong :> length + 0 int :> status [ mangled-name ascii string>alien f length status __cxa_demangle &(free) :> demangled-buf - mangled-name status *int demangle-error + mangled-name status int deref demangle-error demangled-buf ascii alien>string ] with-destructors ; diff --git a/extra/cuda/contexts/contexts.factor b/extra/cuda/contexts/contexts.factor index 7a9ab59a6a..0ba01cc453 100644 --- a/extra/cuda/contexts/contexts.factor +++ b/extra/cuda/contexts/contexts.factor @@ -16,7 +16,7 @@ IN: cuda.contexts cuCtxSynchronize cuda-error ; inline : context-device ( -- n ) - CUdevice [ cuCtxGetDevice cuda-error ] keep *int ; inline + CUdevice [ cuCtxGetDevice cuda-error ] keep int deref ; inline : destroy-context ( context -- ) cuCtxDestroy cuda-error ; inline diff --git a/extra/cuda/devices/devices.factor b/extra/cuda/devices/devices.factor index 4e7a50e6f2..07e066a439 100644 --- a/extra/cuda/devices/devices.factor +++ b/extra/cuda/devices/devices.factor @@ -8,10 +8,11 @@ prettyprint sequences ; IN: cuda.devices : #cuda-devices ( -- n ) - int [ cuDeviceGetCount cuda-error ] keep *int ; + int [ cuDeviceGetCount cuda-error ] keep int deref ; : n>cuda-device ( n -- device ) - [ CUdevice ] dip [ cuDeviceGet cuda-error ] 2keep drop *int ; + [ CUdevice ] dip [ cuDeviceGet cuda-error ] 2keep + drop int deref ; : enumerate-cuda-devices ( -- devices ) #cuda-devices iota [ n>cuda-device ] map ; @@ -34,17 +35,17 @@ IN: cuda.devices : cuda-device-capability ( n -- pair ) [ int int ] dip [ cuDeviceComputeCapability cuda-error ] - [ drop [ *int ] bi@ ] 3bi 2array ; + [ drop [ int deref ] bi@ ] 3bi 2array ; : cuda-device-memory ( n -- bytes ) [ uint ] dip [ cuDeviceTotalMem cuda-error ] - [ drop *uint ] 2bi ; + [ drop uint deref ] 2bi ; : cuda-device-attribute ( attribute n -- n ) [ int ] 2dip [ cuDeviceGetAttribute cuda-error ] - [ 2drop *int ] 3bi ; + [ 2drop int deref ] 3bi ; : cuda-device. ( n -- ) { diff --git a/extra/cuda/gl/gl.factor b/extra/cuda/gl/gl.factor index d4943e1350..6ebee377aa 100644 --- a/extra/cuda/gl/gl.factor +++ b/extra/cuda/gl/gl.factor @@ -24,7 +24,7 @@ IN: cuda.gl [ 1 swap f cuGraphicsMapResources cuda-error ] [ [ CUdeviceptr uint ] dip [ cuGraphicsResourceGetMappedPointer cuda-error ] 3keep drop - [ *uint ] [ *uint ] bi* + [ uint deref ] [ uint deref ] bi* ] bi ; inline : unmap-resource ( resource -- ) diff --git a/extra/ecdsa/ecdsa.factor b/extra/ecdsa/ecdsa.factor index 547b7b9ae9..74fdad63ea 100644 --- a/extra/ecdsa/ecdsa.factor +++ b/extra/ecdsa/ecdsa.factor @@ -67,9 +67,9 @@ PRIVATE> :: ecdsa-sign ( DGST -- sig ) ec-key-handle :> KEY KEY ECDSA_size dup ssl-error :> SIG - 0 :> LEN + 0 uint :> LEN 0 DGST dup length SIG LEN KEY ECDSA_sign ssl-error - LEN *uint SIG resize ; + LEN uint deref SIG resize ; : ecdsa-verify ( dgst sig -- ? ) ec-key-handle [ 0 -rot [ dup length ] bi@ ] dip ECDSA_verify 0 > ; diff --git a/extra/gpu/buffers/buffers.factor b/extra/gpu/buffers/buffers.factor index 6172c8ad8c..9ea08a7c83 100644 --- a/extra/gpu/buffers/buffers.factor +++ b/extra/gpu/buffers/buffers.factor @@ -57,7 +57,7 @@ TUPLE: buffer < gpu-object } case ; inline : get-buffer-int ( target enum -- value ) - 0 [ glGetBufferParameteriv ] keep *int ; inline + 0 int [ glGetBufferParameteriv ] keep int deref ; inline : bind-buffer ( buffer -- target ) [ kind>> gl-target dup ] [ handle>> glBindBuffer ] bi ; inline diff --git a/extra/gpu/framebuffers/framebuffers.factor b/extra/gpu/framebuffers/framebuffers.factor index 1aa9ae33df..6f469a3c8b 100644 --- a/extra/gpu/framebuffers/framebuffers.factor +++ b/extra/gpu/framebuffers/framebuffers.factor @@ -18,7 +18,8 @@ TUPLE: renderbuffer < gpu-object [ glGetRenderbufferParameteriv ] keep *int ; + GL_RENDERBUFFER swap 0 int + [ glGetRenderbufferParameteriv ] keep int deref ; PRIVATE> diff --git a/extra/gpu/shaders/shaders.factor b/extra/gpu/shaders/shaders.factor index d1c137128a..b032004d40 100755 --- a/extra/gpu/shaders/shaders.factor +++ b/extra/gpu/shaders/shaders.factor @@ -199,7 +199,7 @@ TR: hyphens>underscores "-" "_" ; name length 1 + :> name-buffer-length { index name-buffer-length dup - [ f 0 0 ] dip + [ f 0 int 0 int ] dip [ glGetTransformFeedbackVarying ] 3keep ascii alien>string vertex-attribute assert-feedback-attribute diff --git a/extra/gpu/state/state.factor b/extra/gpu/state/state.factor index db76774038..80fc89fea4 100755 --- a/extra/gpu/state/state.factor +++ b/extra/gpu/state/state.factor @@ -416,11 +416,11 @@ M: mask-state set-gpu-state* [ set-gpu-state* ] if ; inline : get-gl-bool ( enum -- value ) - 0 [ glGetBooleanv ] keep *uchar c-bool> ; + 0 uchar [ glGetBooleanv ] keep uchar deref c-bool> ; : get-gl-int ( enum -- value ) - 0 [ glGetIntegerv ] keep *int ; + 0 int [ glGetIntegerv ] keep int deref ; : get-gl-float ( enum -- value ) - 0 [ glGetFloatv ] keep *float ; + 0 float [ glGetFloatv ] keep float deref ; : get-gl-bools ( enum count -- value ) [ glGetBooleanv ] keep [ c-bool> ] { } map-as ; diff --git a/extra/openal/alut/macosx/macosx.factor b/extra/openal/alut/macosx/macosx.factor index 54439b762c..e6e8898b93 100755 --- a/extra/openal/alut/macosx/macosx.factor +++ b/extra/openal/alut/macosx/macosx.factor @@ -9,6 +9,6 @@ LIBRARY: alut FUNCTION: void alutLoadWAVFile ( c-string fileName, ALenum* format, void** data, ALsizei* size, ALsizei* frequency ) ; M: macosx load-wav-file ( path -- format data size frequency ) - 0 f 0 0 + 0 int f 0 int 0 int [ alutLoadWAVFile ] 4 nkeep - [ [ [ *int ] dip *void* ] dip *int ] dip *int ; + [ [ [ int deref ] dip *void* ] dip int deref ] dip int deref ; diff --git a/extra/openal/alut/other/other.factor b/extra/openal/alut/other/other.factor index 8b1cbd0cb3..73b1aca86e 100755 --- a/extra/openal/alut/other/other.factor +++ b/extra/openal/alut/other/other.factor @@ -9,6 +9,9 @@ LIBRARY: alut FUNCTION: void alutLoadWAVFile ( c-string fileName, ALenum* format, void** data, ALsizei* size, ALsizei* frequency, ALboolean* looping ) ; M: object load-wav-file ( filename -- format data size frequency ) - 0 f 0 0 - [ 0 alutLoadWAVFile ] 4 nkeep - { [ *int ] [ *void* ] [ *int ] [ *int ] } spread ; + 0 int + f + 0 int + 0 int + [ 0 char alutLoadWAVFile ] 4 nkeep + { [ int deref ] [ *void* ] [ int deref ] [ int deref ] } spread ; diff --git a/extra/openal/openal.factor b/extra/openal/openal.factor index 853b33b386..b1baa46d30 100755 --- a/extra/openal/openal.factor +++ b/extra/openal/openal.factor @@ -264,13 +264,13 @@ DESTRUCTOR: alcDestroyContext alSourcei ; : get-source-param ( source param -- value ) - 0 dup [ alGetSourcei ] dip *uint ; + 0 uint dup [ alGetSourcei ] dip uint deref ; : set-buffer-param ( source param value -- ) alBufferi ; : get-buffer-param ( source param -- value ) - 0 dup [ alGetBufferi ] dip *uint ; + 0 uint dup [ alGetBufferi ] dip uint deref ; : source-play ( source -- ) alSourcePlay ; diff --git a/extra/opencl/ffi/ffi-tests.factor b/extra/opencl/ffi/ffi-tests.factor index 1ec96e4c76..ab84c07d49 100644 --- a/extra/opencl/ffi/ffi-tests.factor +++ b/extra/opencl/ffi/ffi-tests.factor @@ -29,33 +29,33 @@ ERROR: cl-error err ; str-alien str-buffer dup length memcpy str-alien ; :: opencl-square ( in -- out ) - 0 f 0 [ clGetPlatformIDs cl-success ] keep *uint + 0 f 0 uint [ clGetPlatformIDs cl-success ] keep uint deref dup [ f clGetPlatformIDs cl-success ] keep first CL_DEVICE_TYPE_DEFAULT 1 f [ f clGetDeviceIDs cl-success ] keep *void* :> device-id - f 1 device-id f f 0 [ clCreateContext ] keep *int cl-success :> context - context device-id 0 0 [ clCreateCommandQueue ] keep *int cl-success :> queue + f 1 device-id f f 0 int [ clCreateContext ] keep int deref cl-success :> context + context device-id 0 0 int [ clCreateCommandQueue ] keep int deref cl-success :> queue [ context 1 kernel-source cl-string-array - f 0 [ clCreateProgramWithSource ] keep *int cl-success + f 0 int [ clCreateProgramWithSource ] keep int deref cl-success [ 0 f f f f clBuildProgram cl-success ] - [ "square" cl-string-array 0 [ clCreateKernel ] keep *int cl-success ] + [ "square" cl-string-array 0 int [ clCreateKernel ] keep int deref cl-success ] [ ] tri ] with-destructors :> ( kernel program ) context CL_MEM_READ_ONLY in byte-length f - 0 [ clCreateBuffer ] keep *int cl-success :> input + 0 int [ clCreateBuffer ] keep int deref cl-success :> input context CL_MEM_WRITE_ONLY in byte-length f - 0 [ clCreateBuffer ] keep *int cl-success :> output + 0 int [ clCreateBuffer ] keep int deref cl-success :> output queue input CL_TRUE 0 in byte-length in 0 f f clEnqueueWriteBuffer cl-success kernel 0 cl_mem heap-size input clSetKernelArg cl-success kernel 1 cl_mem heap-size output clSetKernelArg cl-success - kernel 2 uint heap-size in length clSetKernelArg cl-success + kernel 2 uint heap-size in length uint clSetKernelArg cl-success - queue kernel 1 f in length f + queue kernel 1 f in length ulonglong f 0 f f clEnqueueNDRangeKernel cl-success queue clFinish cl-success diff --git a/extra/opencl/opencl-tests.factor b/extra/opencl/opencl-tests.factor index 6fd7bb581d..628a9b0d63 100644 --- a/extra/opencl/opencl-tests.factor +++ b/extra/opencl/opencl-tests.factor @@ -32,7 +32,7 @@ __kernel void square( cl-read-access num-bytes in &dispose :> in-buffer cl-write-access num-bytes f &dispose :> out-buffer - kernel in-buffer out-buffer num-floats 3array + kernel in-buffer out-buffer num-floats uint 3array { num-floats } [ ] cl-queue-kernel &dispose drop cl-finish diff --git a/extra/opencl/opencl.factor b/extra/opencl/opencl.factor index 17f0143ae1..78e96e2ff1 100644 --- a/extra/opencl/opencl.factor +++ b/extra/opencl/opencl.factor @@ -17,7 +17,7 @@ ERROR: cl-error err ; dup f = [ cl-error ] [ drop ] if ; inline : info-data-size ( handle name info-quot -- size_t ) - [ 0 f 0 ] dip [ call cl-success ] 2keep drop *size_t ; inline + [ 0 f 0 ] dip [ call cl-success ] 2keep drop size_t deref ; inline : info-data-bytes ( handle name info-quot size -- bytes ) swap [ dup f ] dip [ call cl-success ] 3keep 2drop ; inline @@ -26,7 +26,7 @@ ERROR: cl-error err ; [ 3dup info-data-size info-data-bytes ] dip call ; inline : 2info-data-size ( handle1 handle2 name info-quot -- size_t ) - [ 0 f 0 ] dip [ call cl-success ] 2keep drop *size_t ; inline + [ 0 f 0 ] dip [ call cl-success ] 2keep drop size_t deref ; inline : 2info-data-bytes ( handle1 handle2 name info-quot size -- bytes ) swap [ dup f ] dip [ call cl-success ] 3keep 2drop ; inline @@ -35,22 +35,22 @@ ERROR: cl-error err ; [ 4dup 2info-data-size 2info-data-bytes ] dip call ; inline : info-bool ( handle name quot -- ? ) - [ *uint CL_TRUE = ] info ; inline + [ uint deref CL_TRUE = ] info ; inline : info-ulong ( handle name quot -- ulong ) - [ *ulonglong ] info ; inline + [ ulonglong deref ] info ; inline : info-int ( handle name quot -- int ) - [ *int ] info ; inline + [ int deref ] info ; inline : info-uint ( handle name quot -- uint ) - [ *uint ] info ; inline + [ uint deref ] info ; inline : info-size_t ( handle name quot -- size_t ) - [ *size_t ] info ; inline + [ size_t deref ] info ; inline : 2info-size_t ( handle1 handle2 name quot -- size_t ) - [ *size_t ] 2info ; inline + [ size_t deref ] 2info ; inline : info-string ( handle name quot -- string ) [ ascii decode 1 head* ] info ; inline @@ -311,7 +311,7 @@ M: cl-filter-linear filter-mode-constant drop CL_FILTER_LINEAR ; : platform-devices ( platform-id -- devices ) CL_DEVICE_TYPE_ALL [ - 0 f 0 [ clGetDeviceIDs cl-success ] keep *uint + 0 f 0 uint [ clGetDeviceIDs cl-success ] keep uint deref ] [ rot dup [ f clGetDeviceIDs cl-success ] keep ] 2bi ; inline @@ -340,7 +340,7 @@ M: cl-filter-linear filter-mode-constant drop CL_FILTER_LINEAR ; [ length ] [ strings>char*-array ] [ [ length ] size_t-array{ } map-as ] tri - 0 [ clCreateProgramWithSource ] keep *int cl-success + 0 int [ clCreateProgramWithSource ] keep int deref cl-success ] with-destructors ; :: (build-program) ( program-handle device options -- program ) @@ -425,7 +425,7 @@ PRIVATE> ] dip bind ; inline : cl-platforms ( -- platforms ) - 0 f 0 [ clGetPlatformIDs cl-success ] keep *uint + 0 f 0 uint [ clGetPlatformIDs cl-success ] keep uint deref dup [ f clGetPlatformIDs cl-success ] keep [ dup @@ -437,14 +437,14 @@ PRIVATE> : ( devices -- cl-context ) [ f ] dip [ length ] [ [ id>> ] void*-array{ } map-as ] bi - f f 0 [ clCreateContext ] keep *int cl-success + f f 0 int [ clCreateContext ] keep int deref cl-success cl-context new-disposable swap >>handle ; : ( context device out-of-order? profiling? -- command-queue ) [ [ handle>> ] [ id>> ] bi* ] 2dip [ [ CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE ] [ 0 ] if ] [ [ CL_QUEUE_PROFILING_ENABLE ] [ 0 ] if ] bi* bitor - 0 [ clCreateCommandQueue ] keep *int cl-success + 0 int [ clCreateCommandQueue ] keep int deref cl-success cl-queue new-disposable swap >>handle ; : cl-out-of-order-execution? ( command-queue -- ? ) @@ -462,7 +462,7 @@ PRIVATE> [ buffer-access-constant ] [ [ CL_MEM_COPY_HOST_PTR ] [ CL_MEM_ALLOC_HOST_PTR ] if ] tri* bitor ] 2dip - 0 [ clCreateBuffer ] keep *int cl-success + 0 int [ clCreateBuffer ] keep int deref cl-success cl-buffer new-disposable swap >>handle ; : cl-read-buffer ( buffer-range -- byte-array ) @@ -512,7 +512,7 @@ PRIVATE> [ [ CL_TRUE ] [ CL_FALSE ] if ] [ addressing-mode-constant ] [ filter-mode-constant ] - tri* 0 [ clCreateSampler ] keep *int cl-success + tri* 0 int [ clCreateSampler ] keep int deref cl-success cl-sampler new-disposable swap >>handle ; : cl-normalized-coords? ( sampler -- ? ) @@ -531,7 +531,7 @@ PRIVATE> : ( program kernel-name -- kernel ) [ handle>> ] [ ascii encode 0 suffix ] bi* - 0 [ clCreateKernel ] keep *int cl-success + 0 int [ clCreateKernel ] keep int deref cl-success cl-kernel new-disposable swap >>handle ; inline : cl-kernel-name ( kernel -- string ) diff --git a/extra/tokyo/assoc-functor/assoc-functor.factor b/extra/tokyo/assoc-functor/assoc-functor.factor index de160f5598..a7e53394bb 100644 --- a/extra/tokyo/assoc-functor/assoc-functor.factor +++ b/extra/tokyo/assoc-functor/assoc-functor.factor @@ -28,14 +28,14 @@ INSTANCE: TYPE assoc M: TYPE dispose* [ DBDEL f ] change-handle drop ; M: TYPE at* ( key db -- value/f ? ) - handle>> swap object>bytes dup length 0 + handle>> swap object>bytes dup length 0 int DBGET [ [ memory>object ] [ tcfree ] bi t ] [ f f ] if* ; M: TYPE assoc-size ( db -- size ) handle>> DBRNUM ; : DBKEYS ( db -- keys ) [ assoc-size ] [ handle>> ] bi - dup DBITERINIT drop 0 + dup DBITERINIT drop 0 int [ 2dup DBITERNEXT dup ] [ [ memory>object ] [ tcfree ] bi [ pick ] dip swap push -- 2.34.1