factor/library/platform/native/primitives.factor

241 lines
11 KiB
Factor
Raw Normal View History

2004-08-31 01:01:43 -04:00
! :folding=none:collapseFolds=1:
! $Id$
!
! Copyright (C) 2004 Slava Pestov.
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions are met:
!
! 1. Redistributions of source code must retain the above copyright notice,
! this list of conditions and the following disclaimer.
!
! 2. Redistributions in binary form must reproduce the above copyright notice,
! this list of conditions and the following disclaimer in the documentation
! and/or other materials provided with the distribution.
!
! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
USE: combinators
2004-09-18 18:15:01 -04:00
USE: alien
USE: compiler
2004-08-31 01:01:43 -04:00
USE: files
USE: io-internals
USE: kernel
2004-09-18 18:15:01 -04:00
USE: lists
2004-08-31 01:01:43 -04:00
USE: math
USE: parser
USE: profiler
2004-09-18 18:15:01 -04:00
USE: random
USE: real-math
2004-08-31 01:01:43 -04:00
USE: stack
2004-09-18 18:15:01 -04:00
USE: strings
USE: unparser
2004-08-31 01:01:43 -04:00
USE: vectors
USE: words
[
[ execute | " word -- " ]
[ call | " quot -- " ]
[ ifte | " cond true false -- " ]
[ cons | " car cdr -- [ car | cdr ] " ]
[ car | " [ car | cdr ] -- car " ]
[ cdr | " [ car | cdr ] -- cdr " ]
[ set-car | " car cons -- " ]
[ set-cdr | " cdr cons -- " ]
[ <vector> | " capacity -- vector" ]
[ vector-length | " vector -- n " ]
[ set-vector-length | " n vector -- " ]
[ vector-nth | " n vector -- obj " ]
[ set-vector-nth | " obj n vector -- " ]
[ str-length | " str -- n " ]
[ str-nth | " n str -- ch " ]
[ str-compare | " str str -- -1/0/1 " ]
[ str= | " str str -- ? " ]
[ str-hashcode | " str -- n " ]
[ index-of* | " n str/ch str -- n " ]
[ substring | " start end str -- str "]
2004-09-19 00:33:40 -04:00
[ str-reverse | " str -- str " ]
2004-08-31 01:01:43 -04:00
[ <sbuf> | " capacity -- sbuf " ]
[ sbuf-length | " sbuf -- n " ]
[ set-sbuf-length | " n sbuf -- " ]
[ sbuf-nth | " n sbuf -- ch " ]
[ set-sbuf-nth | " ch n sbuf -- " ]
[ sbuf-append | " ch/str sbuf -- " ]
[ sbuf>str | " sbuf -- str " ]
[ sbuf-reverse | " sbuf -- " ]
[ sbuf-clone | " sbuf -- sbuf " ]
[ sbuf= | " sbuf sbuf -- ? " ]
2004-09-26 21:34:25 -04:00
[ sbuf-hashcode | " sbuf -- n " ]
2004-09-19 00:33:40 -04:00
[ arithmetic-type | " n n -- type " ]
2004-08-31 01:01:43 -04:00
[ number? | " obj -- ? " ]
[ >fixnum | " n -- fixnum " ]
[ >bignum | " n -- bignum " ]
[ >float | " n -- float " ]
[ numerator | " a/b -- a " ]
[ denominator | " a/b -- b " ]
2004-09-18 22:29:29 -04:00
[ >fraction | " a/b -- a b " ]
[ fraction> | " a b -- a/b " ]
2004-08-31 01:01:43 -04:00
[ str>float | " str -- float " ]
[ unparse-float | " float -- str " ]
[ float>bits | " float -- n " ]
[ real | " #{ re im } -- re " ]
[ imaginary | " #{ re im } -- im " ]
[ >rect | " #{ re im } -- re im " ]
[ rect> | " re im -- #{ re im } " ]
2004-09-19 00:33:40 -04:00
[ fixnum= | " x y -- ? " ]
[ fixnum+ | " x y -- x+y " ]
[ fixnum- | " x y -- x-y " ]
[ fixnum* | " x y -- x*y " ]
[ fixnum/i | " x y -- x/y " ]
[ fixnum/f | " x y -- x/y " ]
[ fixnum-mod | " x y -- x%y " ]
[ fixnum/mod | " x y -- x/y x%y " ]
[ fixnum-bitand | " x y -- x&y " ]
[ fixnum-bitor | " x y -- x|y " ]
[ fixnum-bitxor | " x y -- x^y " ]
[ fixnum-bitnot | " x -- ~x " ]
[ fixnum-shift | " x n -- x<<n" ]
[ fixnum< | " x y -- ? " ]
[ fixnum<= | " x y -- ? " ]
[ fixnum> | " x y -- ? " ]
[ fixnum>= | " x y -- ? " ]
[ bignum= | " x y -- ? " ]
[ bignum+ | " x y -- x+y " ]
[ bignum- | " x y -- x-y " ]
[ bignum* | " x y -- x*y " ]
[ bignum/i | " x y -- x/y " ]
[ bignum/f | " x y -- x/y " ]
[ bignum-mod | " x y -- x%y " ]
[ bignum/mod | " x y -- x/y x%y " ]
[ bignum-bitand | " x y -- x&y " ]
[ bignum-bitor | " x y -- x|y " ]
[ bignum-bitxor | " x y -- x^y " ]
[ bignum-bitnot | " x -- ~x " ]
[ bignum-shift | " x n -- x<<n" ]
[ bignum< | " x y -- ? " ]
[ bignum<= | " x y -- ? " ]
[ bignum> | " x y -- ? " ]
[ bignum>= | " x y -- ? " ]
[ float= | " x y -- ? " ]
[ float+ | " x y -- x+y " ]
[ float- | " x y -- x-y " ]
[ float* | " x y -- x*y " ]
[ float/f | " x y -- x/y " ]
[ float< | " x y -- ? " ]
[ float<= | " x y -- ? " ]
[ float> | " x y -- ? " ]
[ float>= | " x y -- ? " ]
2004-08-31 01:01:43 -04:00
[ facos | " x -- y " ]
[ fasin | " x -- y " ]
[ fatan | " x -- y " ]
[ fatan2 | " x y -- z " ]
[ fcos | " x -- y " ]
[ fexp | " x -- y " ]
[ fcosh | " x -- y " ]
[ flog | " x -- y " ]
[ fpow | " x y -- z " ]
[ fsin | " x -- y " ]
[ fsinh | " x -- y " ]
[ fsqrt | " x -- y " ]
[ <word> | " prim param plist -- word " ]
[ word-hashcode | " word -- n " ]
2004-09-19 00:33:40 -04:00
[ word-xt | " word -- xt " ]
[ set-word-xt | " xt word -- " ]
2004-08-31 01:01:43 -04:00
[ word-primitive | " word -- n " ]
[ set-word-primitive | " n word -- " ]
[ word-parameter | " word -- obj " ]
[ set-word-parameter | " obj word -- " ]
[ word-plist | " word -- alist" ]
[ set-word-plist | " alist word -- " ]
[ drop | " x -- " ]
[ dup | " x -- x x " ]
[ swap | " x y -- y x " ]
[ over | " x y -- x y x " ]
[ pick | " x y z -- x y z x " ]
[ nip | " x y -- y " ]
[ tuck | " x y -- y x y " ]
[ rot | " x y z -- y z x " ]
[ >r | " x -- r:x " ]
[ r> | " r:x -- x " ]
[ eq? | " x y -- ? " ]
[ getenv | " n -- obj " ]
[ setenv | " obj n -- " ]
[ open-file | " path r w -- port " ]
[ stat | " path -- [ dir? perm size mtime ] " ]
[ (directory) | " path -- list " ]
[ garbage-collection | " -- " ]
[ save-image | " path -- " ]
[ datastack | " -- ds " ]
[ callstack | " -- cs " ]
[ set-datastack | " ds -- " ]
[ set-callstack | " cs -- " ]
[ exit* | " n -- " ]
[ client-socket | " host port -- in out " ]
[ server-socket | " port -- server " ]
[ close-port | " port -- " ]
[ add-accept-io-task | " callback server -- " ]
[ accept-fd | " server -- host port in out " ]
[ can-read-line? | " port -- ? " ]
[ add-read-line-io-task | " port callback -- " ]
[ read-line-fd-8 | " port -- sbuf " ]
[ can-read-count? | " n port -- ? " ]
[ add-read-count-io-task | " n port callback -- " ]
[ read-count-fd-8 | " n port -- sbuf " ]
[ can-write? | " n port -- ? " ]
[ add-write-io-task | " port callback -- " ]
[ write-fd-8 | " ch/str port -- " ]
[ add-copy-io-task | " from to callback -- " ]
2004-09-19 00:33:40 -04:00
[ pending-io-error | " -- " ]
2004-08-31 01:01:43 -04:00
[ next-io-task | " -- callback " ]
[ room | " -- free total " ]
[ os-env | " str -- str " ]
[ millis | " -- n " ]
[ init-random | " -- " ]
[ (random-int) | " -- n " ]
2004-09-26 20:16:02 -04:00
[ type | " obj -- n " ]
[ size | " obj -- n " ]
2004-08-31 01:01:43 -04:00
[ call-profiling | " depth -- " ]
[ call-count | " word -- n " ]
[ set-call-count | " n word -- " ]
[ allot-profiling | " depth -- " ]
[ allot-count | " word -- n " ]
[ set-allot-count | " n word -- n " ]
[ dump | " obj -- " ]
[ cwd | " -- dir " ]
[ cd | " dir -- " ]
[ compiled-offset | " -- ptr " ]
[ set-compiled-offset | " ptr -- " ]
2004-09-19 17:39:28 -04:00
[ set-compiled-cell | " n ptr -- " ]
[ set-compiled-byte | " n ptr -- " ]
[ literal-top | " -- ptr " ]
[ set-literal-top | " ptr -- " ]
2004-09-26 20:16:02 -04:00
[ address | " obj -- ptr " ]
2004-09-18 18:15:01 -04:00
[ dlopen | " path -- dll " ]
[ dlsym | " name dll -- ptr " ]
[ dlsym-self | " name -- ptr " ]
[ dlclose | " dll -- " ]
2004-09-19 17:39:28 -04:00
[ <alien> | " ptr len -- alien " ]
2004-09-21 22:58:54 -04:00
[ <local-alien> | " len -- alien " ]
2004-09-19 17:39:28 -04:00
[ alien-cell | " alien off -- n " ]
[ set-alien-cell | " n alien off -- " ]
[ alien-4 | " alien off -- n " ]
[ set-alien-4 | " n alien off -- " ]
2004-09-20 21:02:48 -04:00
[ alien-2 | " alien off -- n " ]
[ set-alien-2 | " n alien off -- " ]
2004-09-19 17:39:28 -04:00
[ alien-1 | " alien off -- n " ]
[ set-alien-1 | " n alien off -- " ]
2004-09-21 12:41:57 -04:00
[ heap-stats | " -- instances bytes " ]
2004-08-31 01:01:43 -04:00
] [
unswons "stack-effect" swap set-word-property
] each