M: number +second ( timestamp n -- timestamp )
[ over second>> + seconds/minutes [ >>second ] dip +minute ] unless-zero ;
-: (time+) ( timestamp duration -- timestamp' )
+: (time+) ( timestamp duration -- timestamp' duration )
[ second>> +second ] keep
[ minute>> +minute ] keep
[ hour>> +hour ] keep
M: ##branch linearize-insn
drop dup successors>> first emit-branch ;
-: (binary-conditional) ( basic-block insn -- basic-block successor1 successor2 src1 src2 cc -- )
+: (binary-conditional) ( basic-block insn -- basic-block successor1 successor2 src1 src2 cc )
[ dup successors>> first2 ]
[ [ src1>> ] [ src2>> ] [ cc>> ] tri ] bi* ; inline
M: ##dispatch generate-insn
[ src>> register ] [ temp>> register ] [ offset>> ] tri %dispatch ;
-: >slot<
+: >slot< ( insn -- dst obj slot tag )
{
[ dst>> register ]
[ obj>> register ]
M: x86.64 param-reg-1 int-regs param-regs first ;
M: x86.64 param-reg-2 int-regs param-regs second ;
-: param-reg-3 int-regs param-regs third ; inline
+: param-reg-3 ( -- reg ) int-regs param-regs third ; inline
M: int-regs return-reg drop RAX ;
M: float-regs return-reg drop XMM0 ;
<PRIVATE
-: iterate-seq [ dup length swap ] dip ; inline
+: iterate-seq ( seq quot -- i seq quot )
+ [ [ length ] keep ] dip ; inline
: (map-next) ( i seq quot -- )
! this uses O(n) more bounds checks than is really necessary
sequences continuations byte-arrays strings math namespaces
system combinators vocabs.loader qualified accessors
stack-checker macros locals generalizations unix.types
-io vocabs vocabs.loader ;
+io vocabs vocabs.loader constants ;
IN: unix
-: PROT_NONE 0 ; inline
-: PROT_READ 1 ; inline
-: PROT_WRITE 2 ; inline
-: PROT_EXEC 4 ; inline
-
-: MAP_FILE 0 ; inline
-: MAP_SHARED 1 ; inline
-: MAP_PRIVATE 2 ; inline
-
-: MAP_FAILED -1 <alien> ; inline
-
-: NGROUPS_MAX 16 ; inline
-
-: DT_UNKNOWN 0 ; inline
-: DT_FIFO 1 ; inline
-: DT_CHR 2 ; inline
-: DT_DIR 4 ; inline
-: DT_BLK 6 ; inline
-: DT_REG 8 ; inline
-: DT_LNK 10 ; inline
-: DT_SOCK 12 ; inline
-: DT_WHT 14 ; inline
+CONSTANT: PROT_NONE 0
+CONSTANT: PROT_READ 1
+CONSTANT: PROT_WRITE 2
+CONSTANT: PROT_EXEC 4
+
+CONSTANT: MAP_FILE 0
+CONSTANT: MAP_SHARED 1
+CONSTANT: MAP_PRIVATE 2
+
+: MAP_FAILED ( -- alien ) -1 <alien> ; inline
+
+CONSTANT: NGROUPS_MAX 16
+
+CONSTANT: DT_UNKNOWN 0
+CONSTANT: DT_FIFO 1
+CONSTANT: DT_CHR 2
+CONSTANT: DT_DIR 4
+CONSTANT: DT_BLK 6
+CONSTANT: DT_REG 8
+CONSTANT: DT_LNK 10
+CONSTANT: DT_SOCK 12
+CONSTANT: DT_WHT 14
C-STRUCT: group
{ "char*" "gr_name" }
} ;
HELP: ?1+
+{ $values { "x" { $maybe number } } { "y" number } }
{ $description "If the input is not " { $link f } ", adds one. Otherwise, outputs a " { $snippet "0" } "." } ;
HELP: sq
: recip ( x -- y ) 1 swap / ; inline
: sgn ( x -- n ) dup 0 < [ drop -1 ] [ 0 > 1 0 ? ] if ; inline
-: ?1+ [ 1+ ] [ 0 ] if* ; inline
+: ?1+ ( x -- y ) [ 1+ ] [ 0 ] if* ; inline
: rem ( x y -- z ) abs tuck mod over + swap mod ; foldable