help:
@echo "Run '$(MAKE)' with one of the following parameters:"
@echo ""
- @echo "freebsd-x86-32"
- @echo "freebsd-x86-64"
@echo "linux-x86-32"
@echo "linux-x86-64"
@echo "linux-ppc-32"
@echo "linux-ppc-64"
@echo "linux-arm"
- @echo "openbsd-x86-32"
- @echo "openbsd-x86-64"
- @echo "netbsd-x86-32"
- @echo "netbsd-x86-64"
@echo "macosx-x86-32"
@echo "macosx-x86-64"
- @echo "macosx-ppc"
- @echo "solaris-x86-32"
- @echo "solaris-x86-64"
@echo "windows-x86-32"
@echo "windows-x86-64"
@echo ""
ALL = factor factor-ffi-test factor-lib
-openbsd-x86-32:
- $(MAKE) $(ALL) CONFIG=vm/Config.openbsd.x86.32
-
-openbsd-x86-64:
- $(MAKE) $(ALL) CONFIG=vm/Config.openbsd.x86.64
-
-freebsd-x86-32:
- $(MAKE) $(ALL) CONFIG=vm/Config.freebsd.x86.32
-
-freebsd-x86-64:
- $(MAKE) $(ALL) CONFIG=vm/Config.freebsd.x86.64
-
-netbsd-x86-32:
- $(MAKE) $(ALL) CONFIG=vm/Config.netbsd.x86.32
-
-netbsd-x86-64:
- $(MAKE) $(ALL) CONFIG=vm/Config.netbsd.x86.64
-
-macosx-ppc:
- $(MAKE) $(ALL) macosx.app CONFIG=vm/Config.macosx.ppc
-
macosx-x86-32:
$(MAKE) $(ALL) macosx.app CONFIG=vm/Config.macosx.x86.32
linux-arm:
$(MAKE) $(ALL) CONFIG=vm/Config.linux.arm
-solaris-x86-32:
- $(MAKE) $(ALL) CONFIG=vm/Config.solaris.x86.32
-
-solaris-x86-64:
- $(MAKE) $(ALL) CONFIG=vm/Config.solaris.x86.64
-
windows-x86-32:
$(MAKE) $(ALL) CONFIG=vm/Config.windows.x86.32
$(MAKE) factor-console CONFIG=vm/Config.windows.x86.32
<<
! This overrides the fact that small structures are never returned
-! in registers on NetBSD, Linux and Solaris running on 32-bit x86.
+! in registers on Linux running on 32-bit x86.
\ complex-float lookup-c-type t >>return-in-registers? drop
>>
[ V{ double-array } ] [ [| | double-array{ } ] final-classes ] unit-test
-[ V{ t } ] [ [ netbsd unix? ] final-literals ] unit-test
+[ V{ t } ] [ [ macosx unix? ] final-literals ] unit-test
[ V{ array } ] [ [ [ <=> ] sort [ <=> ] sort ] final-classes ] unit-test
lookup-c-type
[ return-in-registers?>> ]
[ heap-size { 1 2 4 8 } member? ] bi
- os { linux netbsd solaris } member? not
+ os linux? not
and or ;
! On x86, parameters are usually never passed in registers,
destructors gdk.pixbuf.ffi gobject.ffi grouping images
images.loader io kernel locals math sequences
specialized-arrays ;
-FROM: system => os linux freebsd netbsd openbsd ;
+FROM: system => os linux? ;
IN: images.loader.gtk
SPECIALIZED-ARRAY: uchar
SINGLETON: gtk-image
-os { linux freebsd netbsd openbsd } member? [
+os linux ? [
"png" gtk-image register-image-class
"tif" gtk-image register-image-class
"tiff" gtk-image register-image-class
+++ /dev/null
-Slava Pestov
+++ /dev/null
-! Copyright (C) 2008 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: namespaces system kernel accessors assocs continuations
-unix io.backend io.backend.unix io.backend.unix.multiplexers
-io.backend.unix.multiplexers.kqueue io.files.unix ;
-IN: io.backend.unix.bsd
-
-M: bsd init-io ( -- )
- <kqueue-mx> mx set-global ;
+++ /dev/null
-USING: io.backend.unix.bsd io.backend system ;
-
-freebsd set-io-backend
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: io.backend system namespaces io.backend.unix.bsd
-io.backend.unix.multiplexers io.backend.unix.multiplexers.run-loop ;
+USING: io.backend system namespaces
+io.backend.unix.multiplexers io.backend.unix.multiplexers.run-loop
+kernel accessors assocs continuations unix io.backend.unix
+io.backend.unix.multiplexers
+io.backend.unix.multiplexers.kqueue io.files.unix ;
IN: io.backend.unix.macosx
+SINGLETON: macosx-kqueue
+
+M: macosx-kqueue init-io ( -- )
+ <kqueue-mx> mx set-global ;
+
M: macosx init-io ( -- )
<run-loop-mx> mx set-global ;
+++ /dev/null
-USING: io.backend.unix.bsd io.backend system ;
-
-netbsd set-io-backend
+++ /dev/null
-USING: io.backend.unix.bsd io.backend system ;
-
-openbsd set-io-backend
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: kernel alien.syntax math io.files.unix system
-unix.stat accessors combinators calendar.unix
-io.files.info.unix ;
-IN: io.files.info.unix.bsd
-
-TUPLE: bsd-file-info < unix-file-info birth-time flags gen ;
-
-M: bsd new-file-info ( -- class ) bsd-file-info new ;
-
-M: bsd stat>file-info ( stat -- file-info )
- [ call-next-method ] keep
- {
- [ st_flags>> >>flags ]
- [ st_gen>> >>gen ]
- [ st_birthtimespec>> timespec>unix-time >>birth-time ]
- } cleave ;
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien alien.c-types alien.syntax combinators
-io.backend io.files io.files.info io.files.unix kernel math system unix
-unix.statfs.freebsd unix.statvfs.freebsd unix.getfsstat.freebsd
-sequences grouping alien.strings io.encodings.utf8 unix.types
-arrays io.files.info.unix classes.struct specialized-arrays
-alien.data ;
-SPECIALIZED-ARRAY: statfs
-IN: io.files.info.unix.freebsd
-
-TUPLE: freebsd-file-system-info < unix-file-system-info
-version io-size owner syncreads syncwrites asyncreads asyncwrites ;
-
-M: freebsd new-file-system-info freebsd-file-system-info new ;
-
-M: freebsd file-system-statfs ( path -- byte-array )
- \ statfs <struct> [ statfs io-error ] keep ;
-
-M: freebsd statfs>file-system-info ( file-system-info statvfs -- file-system-info )
- {
- [ f_version>> >>version ]
- [ f_type>> >>type ]
- [ f_flags>> >>flags ]
- [ f_bsize>> >>block-size ]
- [ f_iosize>> >>io-size ]
- [ f_blocks>> >>blocks ]
- [ f_bfree>> >>blocks-free ]
- [ f_bavail>> >>blocks-available ]
- [ f_files>> >>files ]
- [ f_ffree>> >>files-free ]
- [ f_syncwrites>> >>syncwrites ]
- [ f_asyncwrites>> >>asyncwrites ]
- [ f_syncreads>> >>syncreads ]
- [ f_asyncreads>> >>asyncreads ]
- [ f_namemax>> >>name-max ]
- [ f_owner>> >>owner ]
- [ f_fsid>> >>id ]
- [ f_fstypename>> utf8 alien>string >>type ]
- [ f_mntfromname>> utf8 alien>string >>device-name ]
- [ f_mntonname>> utf8 alien>string >>mount-point ]
- } cleave ;
-
-M: freebsd file-system-statvfs ( path -- byte-array )
- \ statvfs <struct> [ statvfs io-error ] keep ;
-
-M: freebsd statvfs>file-system-info ( file-system-info statvfs -- file-system-info )
- {
- [ f_favail>> >>files-available ]
- [ f_frsize>> >>preferred-block-size ]
- } cleave ;
-
-M: freebsd file-systems ( -- array )
- f 0 0 getfsstat dup io-error
- \ statfs <c-array>
- [ dup byte-length 0 getfsstat io-error ]
- [ [ f_mntonname>> utf8 alien>string file-system-info ] { } map-as ] bi ;
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien.c-types alien.data alien.strings
-combinators grouping io.encodings.utf8 io.files kernel math
-sequences system unix io.files.unix arrays unix.statfs.macosx
-unix.statvfs.macosx unix.getfsstat.macosx io.files.info.unix
-io.files.info classes.struct specialized-arrays ;
+USING: accessors alien.c-types alien.data alien.strings arrays
+calendar.unix classes.struct combinators grouping
+io.encodings.utf8 io.files io.files.info io.files.info.unix
+io.files.unix kernel math sequences specialized-arrays
+system unix unix.getfsstat.macosx unix.statfs.macosx
+unix.statvfs.macosx ;
SPECIALIZED-ARRAY: uint
SPECIALIZED-ARRAY: statfs64
IN: io.files.info.unix.macosx
+TUPLE: macosx-file-info < unix-file-info birth-time flags gen ;
+
+M: macosx new-file-info ( -- class ) macosx-file-info new ;
+
+M: macosx stat>file-info ( stat -- file-info )
+ [ call-next-method ] keep
+ {
+ [ st_flags>> >>flags ]
+ [ st_gen>> >>gen ]
+ [ st_birthtimespec>> timespec>unix-time >>birth-time ]
+ } cleave ;
+
TUPLE: macosx-file-system-info < unix-file-system-info
io-size owner type-id filesystem-subtype ;
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien alien.syntax kernel unix.stat math unix
-combinators system io.backend accessors alien.c-types
-io.encodings.utf8 alien.strings unix.types io.files.unix
-io.files io.files.info unix.statvfs.netbsd unix.getfsstat.netbsd arrays
-grouping sequences io.encodings.utf8 classes.struct alien.data
-specialized-arrays io.files.info.unix ;
-SPECIALIZED-ARRAY: statvfs
-IN: io.files.info.unix.netbsd
-
-TUPLE: netbsd-file-system-info < unix-file-system-info
-blocks-reserved files-reserved
-owner io-size sync-reads sync-writes async-reads async-writes
-idx mount-from ;
-
-M: netbsd new-file-system-info netbsd-file-system-info new ;
-
-M: netbsd file-system-statvfs
- \ statvfs <struct> [ statvfs io-error ] keep ;
-
-M: netbsd statvfs>file-system-info ( file-system-info statvfs -- file-system-info' )
- {
- [ f_flag>> >>flags ]
- [ f_bsize>> >>block-size ]
- [ f_frsize>> >>preferred-block-size ]
- [ f_iosize>> >>io-size ]
- [ f_blocks>> >>blocks ]
- [ f_bfree>> >>blocks-free ]
- [ f_bavail>> >>blocks-available ]
- [ f_bresvd>> >>blocks-reserved ]
- [ f_files>> >>files ]
- [ f_ffree>> >>files-free ]
- [ f_favail>> >>files-available ]
- [ f_fresvd>> >>files-reserved ]
- [ f_syncreads>> >>sync-reads ]
- [ f_syncwrites>> >>sync-writes ]
- [ f_asyncreads>> >>async-reads ]
- [ f_asyncwrites>> >>async-writes ]
- [ f_fsidx>> >>idx ]
- [ f_fsid>> >>id ]
- [ f_namemax>> >>name-max ]
- [ f_owner>> >>owner ]
- [ f_fstypename>> utf8 alien>string >>type ]
- [ f_mntonname>> utf8 alien>string >>mount-point ]
- [ f_mntfromname>> utf8 alien>string >>device-name ]
- } cleave ;
-
-M: netbsd file-systems ( -- array )
- f 0 0 getvfsstat dup io-error
- \ statvfs <c-array>
- [ dup byte-length 0 getvfsstat io-error ]
- [ [ f_mntonname>> utf8 alien>string file-system-info ] { } map-as ] bi ;
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien alien.c-types alien.strings alien.syntax
-combinators io.backend io.files io.files.info io.files.unix kernel math
-sequences system unix unix.getfsstat.openbsd grouping
-unix.statfs.openbsd unix.statvfs.openbsd unix.types
-arrays io.files.info.unix classes.struct alien.data
-specialized-arrays io.encodings.utf8 ;
-SPECIALIZED-ARRAY: statfs
-IN: io.files.unix.openbsd
-
-TUPLE: openbsd-file-system-info < unix-file-system-info
-io-size sync-writes sync-reads async-writes async-reads
-owner ;
-
-M: openbsd new-file-system-info openbsd-file-system-info new ;
-
-M: openbsd file-system-statfs
- \ statfs <struct> [ statfs io-error ] keep ;
-
-M: openbsd statfs>file-system-info ( file-system-info statfs -- file-system-info' )
- {
- [ f_flags>> >>flags ]
- [ f_bsize>> >>block-size ]
- [ f_iosize>> >>io-size ]
- [ f_blocks>> >>blocks ]
- [ f_bfree>> >>blocks-free ]
- [ f_bavail>> >>blocks-available ]
- [ f_files>> >>files ]
- [ f_ffree>> >>files-free ]
- [ f_favail>> >>files-available ]
- [ f_syncwrites>> >>sync-writes ]
- [ f_syncreads>> >>sync-reads ]
- [ f_asyncwrites>> >>async-writes ]
- [ f_asyncreads>> >>async-reads ]
- [ f_fsid>> >>id ]
- [ f_namemax>> >>name-max ]
- [ f_owner>> >>owner ]
- [ f_fstypename>> utf8 alien>string >>type ]
- [ f_mntonname>> utf8 alien>string >>mount-point ]
- [ f_mntfromname>> utf8 alien>string >>device-name ]
- } cleave ;
-
-M: openbsd file-system-statvfs ( normalized-path -- statvfs )
- \ statvfs <struct> [ statvfs io-error ] keep ;
-
-M: openbsd statvfs>file-system-info ( file-system-info statvfs -- file-system-info' )
- f_frsize>> >>preferred-block-size ;
-
-M: openbsd file-systems ( -- seq )
- f 0 0 getfsstat dup io-error
- \ statfs <c-array>
- [ dup byte-length 0 getfsstat io-error ]
- [ [ f_mntonname>> utf8 alien>string file-system-info ] { } map-as ] bi ;
{ [ os macosx? ] [ "io.monitors.macosx" require ] }
{ [ os linux? ] [ "io.monitors.linux" require ] }
{ [ os windows? ] [ "io.monitors.windows" require ] }
- { [ os bsd? ] [ ] }
} cond
HELP: memcpy
{ $values { "dst" c-ptr } { "src" c-ptr } { "size" "a non-negative integer" } }
{ $description "Copies " { $snippet "size" } " bytes from " { $snippet "src" } " to " { $snippet "dst" } "." }
-{ $warning "As per the BSD C library documentation, the behavior is undefined if the source and destination overlap." } ;
+{ $warning "According to the BSD C library documentation, the behavior is undefined if the source and destination overlap." } ;
HELP: check-ptr
{ $values { "c-ptr" "an alien address, byte array, or " { $link f } } }
-1.0 3.0 /f double>bits
] unit-test
-! FP traps cause a kernel panic on OpenBSD 4.5 i386
-os openbsd eq? cpu x86.32 eq? and [
-
- : fp-trap-error? ( error -- ? )
- 2 head { "kernel-error" 17 } = ;
-
- : test-traps ( traps inputs quot -- quot' fail-quot )
- append '[ _ _ with-fp-traps ] [ fp-trap-error? ] ;
-
- : test-traps-compiled ( traps inputs quot -- quot' fail-quot )
- swapd '[ @ [ _ _ with-fp-traps ] compile-call ] [ fp-trap-error? ] ;
-
- { +fp-zero-divide+ } [ 1.0 0.0 ] [ /f ] test-traps must-fail-with
- { +fp-inexact+ } [ 1.0 3.0 ] [ /f ] test-traps must-fail-with
- { +fp-invalid-operation+ } [ -1.0 ] [ fsqrt ] test-traps must-fail-with
- { +fp-overflow+ } [ 2.0 ] [ 100,000.0 ^ ] test-traps must-fail-with
- { +fp-underflow+ +fp-inexact+ } [ 2.0 ] [ -100,000.0 ^ ] test-traps must-fail-with
-
- { +fp-zero-divide+ } [ 1.0 0.0 ] [ /f ] test-traps-compiled must-fail-with
- { +fp-inexact+ } [ 1.0 3.0 ] [ /f ] test-traps-compiled must-fail-with
- { +fp-invalid-operation+ } [ -1.0 ] [ fsqrt ] test-traps-compiled must-fail-with
- { +fp-overflow+ } [ 2.0 ] [ 100,000.0 ^ ] test-traps-compiled must-fail-with
- { +fp-underflow+ +fp-inexact+ } [ 2.0 ] [ -100,000.0 ^ ] test-traps-compiled must-fail-with
-
- ! Ensure ordered comparisons raise traps
- :: test-comparison-quot ( word -- quot )
- [
- { float float } declare
- { +fp-invalid-operation+ } [ word execute ] with-fp-traps
- ] ;
-
- : test-comparison ( inputs word -- quot fail-quot )
- test-comparison-quot append [ fp-trap-error? ] ;
-
- : test-comparison-compiled ( inputs word -- quot fail-quot )
- test-comparison-quot '[ @ _ compile-call ] [ fp-trap-error? ] ;
-
- \ float< "intrinsic" word-prop [
- [ 0/0. -15.0 ] \ < test-comparison must-fail-with
- [ 0/0. -15.0 ] \ < test-comparison-compiled must-fail-with
- [ -15.0 0/0. ] \ < test-comparison must-fail-with
- [ -15.0 0/0. ] \ < test-comparison-compiled must-fail-with
- [ 0/0. -15.0 ] \ <= test-comparison must-fail-with
- [ 0/0. -15.0 ] \ <= test-comparison-compiled must-fail-with
- [ -15.0 0/0. ] \ <= test-comparison must-fail-with
- [ -15.0 0/0. ] \ <= test-comparison-compiled must-fail-with
- [ 0/0. -15.0 ] \ > test-comparison must-fail-with
- [ 0/0. -15.0 ] \ > test-comparison-compiled must-fail-with
- [ -15.0 0/0. ] \ > test-comparison must-fail-with
- [ -15.0 0/0. ] \ > test-comparison-compiled must-fail-with
- [ 0/0. -15.0 ] \ >= test-comparison must-fail-with
- [ 0/0. -15.0 ] \ >= test-comparison-compiled must-fail-with
- [ -15.0 0/0. ] \ >= test-comparison must-fail-with
- [ -15.0 0/0. ] \ >= test-comparison-compiled must-fail-with
-
- [ f ] [ 0/0. -15.0 ] \ u< test-comparison drop unit-test
- [ f ] [ 0/0. -15.0 ] \ u< test-comparison-compiled drop unit-test
- [ f ] [ -15.0 0/0. ] \ u< test-comparison drop unit-test
- [ f ] [ -15.0 0/0. ] \ u< test-comparison-compiled drop unit-test
- [ f ] [ 0/0. -15.0 ] \ u<= test-comparison drop unit-test
- [ f ] [ 0/0. -15.0 ] \ u<= test-comparison-compiled drop unit-test
- [ f ] [ -15.0 0/0. ] \ u<= test-comparison drop unit-test
- [ f ] [ -15.0 0/0. ] \ u<= test-comparison-compiled drop unit-test
- [ f ] [ 0/0. -15.0 ] \ u> test-comparison drop unit-test
- [ f ] [ 0/0. -15.0 ] \ u> test-comparison-compiled drop unit-test
- [ f ] [ -15.0 0/0. ] \ u> test-comparison drop unit-test
- [ f ] [ -15.0 0/0. ] \ u> test-comparison-compiled drop unit-test
- [ f ] [ 0/0. -15.0 ] \ u>= test-comparison drop unit-test
- [ f ] [ 0/0. -15.0 ] \ u>= test-comparison-compiled drop unit-test
- [ f ] [ -15.0 0/0. ] \ u>= test-comparison drop unit-test
- [ f ] [ -15.0 0/0. ] \ u>= test-comparison-compiled drop unit-test
- ] when
-
-] unless
+: fp-trap-error? ( error -- ? )
+ 2 head { "kernel-error" 17 } = ;
+
+: test-traps ( traps inputs quot -- quot' fail-quot )
+ append '[ _ _ with-fp-traps ] [ fp-trap-error? ] ;
+
+: test-traps-compiled ( traps inputs quot -- quot' fail-quot )
+ swapd '[ @ [ _ _ with-fp-traps ] compile-call ] [ fp-trap-error? ] ;
+
+{ +fp-zero-divide+ } [ 1.0 0.0 ] [ /f ] test-traps must-fail-with
+{ +fp-inexact+ } [ 1.0 3.0 ] [ /f ] test-traps must-fail-with
+{ +fp-invalid-operation+ } [ -1.0 ] [ fsqrt ] test-traps must-fail-with
+{ +fp-overflow+ } [ 2.0 ] [ 100,000.0 ^ ] test-traps must-fail-with
+{ +fp-underflow+ +fp-inexact+ } [ 2.0 ] [ -100,000.0 ^ ] test-traps must-fail-with
+
+{ +fp-zero-divide+ } [ 1.0 0.0 ] [ /f ] test-traps-compiled must-fail-with
+{ +fp-inexact+ } [ 1.0 3.0 ] [ /f ] test-traps-compiled must-fail-with
+{ +fp-invalid-operation+ } [ -1.0 ] [ fsqrt ] test-traps-compiled must-fail-with
+{ +fp-overflow+ } [ 2.0 ] [ 100,000.0 ^ ] test-traps-compiled must-fail-with
+{ +fp-underflow+ +fp-inexact+ } [ 2.0 ] [ -100,000.0 ^ ] test-traps-compiled must-fail-with
+
+! Ensure ordered comparisons raise traps
+:: test-comparison-quot ( word -- quot )
+ [
+ { float float } declare
+ { +fp-invalid-operation+ } [ word execute ] with-fp-traps
+ ] ;
+
+: test-comparison ( inputs word -- quot fail-quot )
+ test-comparison-quot append [ fp-trap-error? ] ;
+
+: test-comparison-compiled ( inputs word -- quot fail-quot )
+ test-comparison-quot '[ @ _ compile-call ] [ fp-trap-error? ] ;
+
+\ float< "intrinsic" word-prop [
+ [ 0/0. -15.0 ] \ < test-comparison must-fail-with
+ [ 0/0. -15.0 ] \ < test-comparison-compiled must-fail-with
+ [ -15.0 0/0. ] \ < test-comparison must-fail-with
+ [ -15.0 0/0. ] \ < test-comparison-compiled must-fail-with
+ [ 0/0. -15.0 ] \ <= test-comparison must-fail-with
+ [ 0/0. -15.0 ] \ <= test-comparison-compiled must-fail-with
+ [ -15.0 0/0. ] \ <= test-comparison must-fail-with
+ [ -15.0 0/0. ] \ <= test-comparison-compiled must-fail-with
+ [ 0/0. -15.0 ] \ > test-comparison must-fail-with
+ [ 0/0. -15.0 ] \ > test-comparison-compiled must-fail-with
+ [ -15.0 0/0. ] \ > test-comparison must-fail-with
+ [ -15.0 0/0. ] \ > test-comparison-compiled must-fail-with
+ [ 0/0. -15.0 ] \ >= test-comparison must-fail-with
+ [ 0/0. -15.0 ] \ >= test-comparison-compiled must-fail-with
+ [ -15.0 0/0. ] \ >= test-comparison must-fail-with
+ [ -15.0 0/0. ] \ >= test-comparison-compiled must-fail-with
+
+ [ f ] [ 0/0. -15.0 ] \ u< test-comparison drop unit-test
+ [ f ] [ 0/0. -15.0 ] \ u< test-comparison-compiled drop unit-test
+ [ f ] [ -15.0 0/0. ] \ u< test-comparison drop unit-test
+ [ f ] [ -15.0 0/0. ] \ u< test-comparison-compiled drop unit-test
+ [ f ] [ 0/0. -15.0 ] \ u<= test-comparison drop unit-test
+ [ f ] [ 0/0. -15.0 ] \ u<= test-comparison-compiled drop unit-test
+ [ f ] [ -15.0 0/0. ] \ u<= test-comparison drop unit-test
+ [ f ] [ -15.0 0/0. ] \ u<= test-comparison-compiled drop unit-test
+ [ f ] [ 0/0. -15.0 ] \ u> test-comparison drop unit-test
+ [ f ] [ 0/0. -15.0 ] \ u> test-comparison-compiled drop unit-test
+ [ f ] [ -15.0 0/0. ] \ u> test-comparison drop unit-test
+ [ f ] [ -15.0 0/0. ] \ u> test-comparison-compiled drop unit-test
+ [ f ] [ 0/0. -15.0 ] \ u>= test-comparison drop unit-test
+ [ f ] [ 0/0. -15.0 ] \ u>= test-comparison-compiled drop unit-test
+ [ f ] [ -15.0 0/0. ] \ u>= test-comparison drop unit-test
+ [ f ] [ -15.0 0/0. ] \ u>= test-comparison-compiled drop unit-test
+] when
! Ensure traps get cleared
[ 1/0. ] [ 1.0 0.0 /f ] unit-test
<<
{
- { [ os openbsd? ] [ ] } ! VM is linked with it
- { [ os netbsd? ] [ ] }
{ [ os windows? ] [ "libcrypto" "libeay32.dll" cdecl add-library ] }
{ [ os macosx? ] [ "libcrypto" "libcrypto.dylib" cdecl add-library ] }
{ [ os unix? ] [ "libcrypto" "libcrypto.so" cdecl add-library ] }
IN: openssl.libssl
<< {
- { [ os openbsd? ] [ ] } ! VM is linked with it
- { [ os netbsd? ] [ ] }
{ [ os windows? ] [ "libssl" "ssleay32.dll" cdecl add-library ] }
{ [ os macosx? ] [ "libssl" "libssl.dylib" cdecl add-library ] }
{ [ os unix? ] [ "libssl" "libssl.so" cdecl add-library ] }
M: unix-random random-bytes* ( n tuple -- byte-array )
reader>> stream-read ;
-os openbsd? [
- [
- "/dev/srandom" <unix-random> &dispose secure-random-generator set-global
- "/dev/arandom" <unix-random> &dispose system-random-generator set-global
- ] "random.unix" add-startup-hook
-] [
- [
- "/dev/random" <unix-random> &dispose secure-random-generator set-global
- "/dev/urandom" <unix-random> &dispose system-random-generator set-global
- ] "random.unix" add-startup-hook
-] if
+[
+ "/dev/random" <unix-random> &dispose secure-random-generator set-global
+ "/dev/urandom" <unix-random> &dispose system-random-generator set-global
+] "random.unix" add-startup-hook
linux
-freebsd
-netbsd
-openbsd
+++ /dev/null
-Slava Pestov
+++ /dev/null
-! Copyright (C) 2005, 2006 Slava Pestov.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax classes.struct combinators
-system unix.types vocabs ;
-IN: unix.ffi
-
-CONSTANT: MAXPATHLEN 1024
-
-CONSTANT: O_RDONLY HEX: 0000
-CONSTANT: O_WRONLY HEX: 0001
-CONSTANT: O_RDWR HEX: 0002
-CONSTANT: O_NONBLOCK HEX: 0004
-CONSTANT: O_APPEND HEX: 0008
-CONSTANT: O_CREAT HEX: 0200
-CONSTANT: O_TRUNC HEX: 0400
-CONSTANT: O_EXCL HEX: 0800
-CONSTANT: O_NOCTTY HEX: 20000
-ALIAS: O_NDELAY O_NONBLOCK
-
-CONSTANT: SOL_SOCKET HEX: ffff
-CONSTANT: SO_REUSEADDR HEX: 4
-CONSTANT: SO_OOBINLINE HEX: 100
-CONSTANT: SO_SNDTIMEO HEX: 1005
-CONSTANT: SO_RCVTIMEO HEX: 1006
-
-CONSTANT: F_SETFD 2
-CONSTANT: F_SETFL 4
-CONSTANT: FD_CLOEXEC 1
-
-STRUCT: sockaddr-in
- { len uchar }
- { family uchar }
- { port ushort }
- { addr in_addr_t }
- { unused longlong } ;
-
-STRUCT: sockaddr-in6
- { len uchar }
- { family uchar }
- { port ushort }
- { flowinfo uint }
- { addr uchar[16] }
- { scopeid uint } ;
-
-STRUCT: sockaddr-un
- { len uchar }
- { family uchar }
- { path char[104] } ;
-
-STRUCT: passwd
- { pw_name c-string }
- { pw_passwd c-string }
- { pw_uid uid_t }
- { pw_gid gid_t }
- { pw_change time_t }
- { pw_class c-string }
- { pw_gecos c-string }
- { pw_dir c-string }
- { pw_shell c-string }
- { pw_expire time_t }
- { pw_fields int } ;
-
-CONSTANT: max-un-path 104
-
-CONSTANT: SOCK_STREAM 1
-CONSTANT: SOCK_DGRAM 2
-CONSTANT: SOCK_RAW 3
-
-CONSTANT: AF_UNSPEC 0
-CONSTANT: AF_UNIX 1
-CONSTANT: AF_INET 2
-
-ALIAS: PF_UNSPEC AF_UNSPEC
-ALIAS: PF_UNIX AF_UNIX
-ALIAS: PF_INET AF_INET
-
-CONSTANT: IPPROTO_TCP 6
-CONSTANT: IPPROTO_UDP 17
-
-CONSTANT: AI_PASSIVE 1
-
-CONSTANT: SEEK_SET 0
-CONSTANT: SEEK_CUR 1
-CONSTANT: SEEK_END 2
-
-os {
- { macosx [ "unix.ffi.bsd.macosx" require ] }
- { freebsd [ "unix.ffi.bsd.freebsd" require ] }
- { openbsd [ "unix.ffi.bsd.openbsd" require ] }
- { netbsd [ "unix.ffi.bsd.netbsd" require ] }
-} case
+++ /dev/null
-USING: alien.c-types alien.syntax classes.struct unix.types ;
-IN: unix.ffi
-
-CONSTANT: AF_INET6 28
-ALIAS: PF_INET6 AF_INET6
-
-CONSTANT: FD_SETSIZE 1024
-
-STRUCT: addrinfo
- { flags int }
- { family int }
- { socktype int }
- { protocol int }
- { addrlen socklen_t }
- { canonname c-string }
- { addr void* }
- { next addrinfo* } ;
-
-STRUCT: dirent
- { d_fileno u_int32_t }
- { d_reclen u_int16_t }
- { d_type u_int8_t }
- { d_namlen u_int8_t }
- { d_name char[256] } ;
-
-CONSTANT: EPERM 1
-CONSTANT: ENOENT 2
-CONSTANT: ESRCH 3
-CONSTANT: EINTR 4
-CONSTANT: EIO 5
-CONSTANT: ENXIO 6
-CONSTANT: E2BIG 7
-CONSTANT: ENOEXEC 8
-CONSTANT: EBADF 9
-CONSTANT: ECHILD 10
-CONSTANT: EDEADLK 11
-CONSTANT: ENOMEM 12
-CONSTANT: EACCES 13
-CONSTANT: EFAULT 14
-CONSTANT: ENOTBLK 15
-CONSTANT: EBUSY 16
-CONSTANT: EEXIST 17
-CONSTANT: EXDEV 18
-CONSTANT: ENODEV 19
-CONSTANT: ENOTDIR 20
-CONSTANT: EISDIR 21
-CONSTANT: EINVAL 22
-CONSTANT: ENFILE 23
-CONSTANT: EMFILE 24
-CONSTANT: ENOTTY 25
-CONSTANT: ETXTBSY 26
-CONSTANT: EFBIG 27
-CONSTANT: ENOSPC 28
-CONSTANT: ESPIPE 29
-CONSTANT: EROFS 30
-CONSTANT: EMLINK 31
-CONSTANT: EPIPE 32
-CONSTANT: EDOM 33
-CONSTANT: ERANGE 34
-CONSTANT: EAGAIN 35
-ALIAS: EWOULDBLOCK EAGAIN
-CONSTANT: EINPROGRESS 36
-CONSTANT: EALREADY 37
-CONSTANT: ENOTSOCK 38
-CONSTANT: EDESTADDRREQ 39
-CONSTANT: EMSGSIZE 40
-CONSTANT: EPROTOTYPE 41
-CONSTANT: ENOPROTOOPT 42
-CONSTANT: EPROTONOSUPPORT 43
-CONSTANT: ESOCKTNOSUPPORT 44
-CONSTANT: EOPNOTSUPP 45
-ALIAS: ENOTSUP EOPNOTSUPP
-CONSTANT: EPFNOSUPPORT 46
-CONSTANT: EAFNOSUPPORT 47
-CONSTANT: EADDRINUSE 48
-CONSTANT: EADDRNOTAVAIL 49
-CONSTANT: ENETDOWN 50
-CONSTANT: ENETUNREACH 51
-CONSTANT: ENETRESET 52
-CONSTANT: ECONNABORTED 53
-CONSTANT: ECONNRESET 54
-CONSTANT: ENOBUFS 55
-CONSTANT: EISCONN 56
-CONSTANT: ENOTCONN 57
-CONSTANT: ESHUTDOWN 58
-CONSTANT: ETOOMANYREFS 59
-CONSTANT: ETIMEDOUT 60
-CONSTANT: ECONNREFUSED 61
-CONSTANT: ELOOP 62
-CONSTANT: ENAMETOOLONG 63
-CONSTANT: EHOSTDOWN 64
-CONSTANT: EHOSTUNREACH 65
-CONSTANT: ENOTEMPTY 66
-CONSTANT: EPROCLIM 67
-CONSTANT: EUSERS 68
-CONSTANT: EDQUOT 69
-CONSTANT: ESTALE 70
-CONSTANT: EREMOTE 71
-CONSTANT: EBADRPC 72
-CONSTANT: ERPCMISMATCH 73
-CONSTANT: EPROGUNAVAIL 74
-CONSTANT: EPROGMISMATCH 75
-CONSTANT: EPROCUNAVAIL 76
-CONSTANT: ENOLCK 77
-CONSTANT: ENOSYS 78
-CONSTANT: EFTYPE 79
-CONSTANT: EAUTH 80
-CONSTANT: ENEEDAUTH 81
-CONSTANT: EIDRM 82
-CONSTANT: ENOMSG 83
-CONSTANT: EOVERFLOW 84
-CONSTANT: ECANCELED 85
-CONSTANT: EILSEQ 86
-CONSTANT: ENOATTR 87
-CONSTANT: EDOOFUS 88
-CONSTANT: EBADMSG 89
-CONSTANT: EMULTIHOP 90
-CONSTANT: ENOLINK 91
-CONSTANT: EPROTO 92
+++ /dev/null
-USING: alien alien.c-types alien.libraries alien.syntax
-classes.struct combinators kernel system unix unix.time
-unix.types vocabs vocabs.loader ;
-IN: unix.ffi
-
-CONSTANT: FD_SETSIZE 1024
-
-CONSTANT: AF_INET6 30
-ALIAS: PF_INET6 AF_INET6
-
-STRUCT: addrinfo
- { flags int }
- { family int }
- { socktype int }
- { protocol int }
- { addrlen socklen_t }
- { canonname c-string }
- { addr void* }
- { next addrinfo* } ;
-
-CONSTANT: _UTX_USERSIZE 256
-CONSTANT: _UTX_LINESIZE 32
-CONSTANT: _UTX_IDSIZE 4
-CONSTANT: _UTX_HOSTSIZE 256
-
-STRUCT: utmpx
- { ut_user { char _UTX_USERSIZE } }
- { ut_id { char _UTX_IDSIZE } }
- { ut_line { char _UTX_LINESIZE } }
- { ut_pid pid_t }
- { ut_type short }
- { ut_tv timeval }
- { ut_host { char _UTX_HOSTSIZE } }
- { ut_pad { uint 16 } } ;
-
-CONSTANT: __DARWIN_MAXPATHLEN 1024
-CONSTANT: __DARWIN_MAXNAMELEN 255
-CONSTANT: __DARWIN_MAXNAMELEN+1 256
-
-STRUCT: dirent
- { d_ino ino_t }
- { d_reclen __uint16_t }
- { d_type __uint8_t }
- { d_namlen __uint8_t }
- { d_name { char __DARWIN_MAXNAMELEN+1 } } ;
-
-CONSTANT: EPERM 1
-CONSTANT: ENOENT 2
-CONSTANT: ESRCH 3
-CONSTANT: EINTR 4
-CONSTANT: EIO 5
-CONSTANT: ENXIO 6
-CONSTANT: E2BIG 7
-CONSTANT: ENOEXEC 8
-CONSTANT: EBADF 9
-CONSTANT: ECHILD 10
-CONSTANT: EDEADLK 11
-CONSTANT: ENOMEM 12
-CONSTANT: EACCES 13
-CONSTANT: EFAULT 14
-CONSTANT: ENOTBLK 15
-CONSTANT: EBUSY 16
-CONSTANT: EEXIST 17
-CONSTANT: EXDEV 18
-CONSTANT: ENODEV 19
-CONSTANT: ENOTDIR 20
-CONSTANT: EISDIR 21
-CONSTANT: EINVAL 22
-CONSTANT: ENFILE 23
-CONSTANT: EMFILE 24
-CONSTANT: ENOTTY 25
-CONSTANT: ETXTBSY 26
-CONSTANT: EFBIG 27
-CONSTANT: ENOSPC 28
-CONSTANT: ESPIPE 29
-CONSTANT: EROFS 30
-CONSTANT: EMLINK 31
-CONSTANT: EPIPE 32
-CONSTANT: EDOM 33
-CONSTANT: ERANGE 34
-CONSTANT: EAGAIN 35
-ALIAS: EWOULDBLOCK EAGAIN
-CONSTANT: EINPROGRESS 36
-CONSTANT: EALREADY 37
-CONSTANT: ENOTSOCK 38
-CONSTANT: EDESTADDRREQ 39
-CONSTANT: EMSGSIZE 40
-CONSTANT: EPROTOTYPE 41
-CONSTANT: ENOPROTOOPT 42
-CONSTANT: EPROTONOSUPPORT 43
-CONSTANT: ESOCKTNOSUPPORT 44
-CONSTANT: ENOTSUP 45
-CONSTANT: EPFNOSUPPORT 46
-CONSTANT: EAFNOSUPPORT 47
-CONSTANT: EADDRINUSE 48
-CONSTANT: EADDRNOTAVAIL 49
-CONSTANT: ENETDOWN 50
-CONSTANT: ENETUNREACH 51
-CONSTANT: ENETRESET 52
-CONSTANT: ECONNABORTED 53
-CONSTANT: ECONNRESET 54
-CONSTANT: ENOBUFS 55
-CONSTANT: EISCONN 56
-CONSTANT: ENOTCONN 57
-CONSTANT: ESHUTDOWN 58
-CONSTANT: ETOOMANYREFS 59
-CONSTANT: ETIMEDOUT 60
-CONSTANT: ECONNREFUSED 61
-CONSTANT: ELOOP 62
-CONSTANT: ENAMETOOLONG 63
-CONSTANT: EHOSTDOWN 64
-CONSTANT: EHOSTUNREACH 65
-CONSTANT: ENOTEMPTY 66
-CONSTANT: EPROCLIM 67
-CONSTANT: EUSERS 68
-CONSTANT: EDQUOT 69
-CONSTANT: ESTALE 70
-CONSTANT: EREMOTE 71
-CONSTANT: EBADRPC 72
-CONSTANT: ERPCMISMATCH 73
-CONSTANT: EPROGUNAVAIL 74
-CONSTANT: EPROGMISMATCH 75
-CONSTANT: EPROCUNAVAIL 76
-CONSTANT: ENOLCK 77
-CONSTANT: ENOSYS 78
-CONSTANT: EFTYPE 79
-CONSTANT: EAUTH 80
-CONSTANT: ENEEDAUTH 81
-CONSTANT: EPWROFF 82
-CONSTANT: EDEVERR 83
-CONSTANT: EOVERFLOW 84
-CONSTANT: EBADEXEC 85
-CONSTANT: EBADARCH 86
-CONSTANT: ESHLIBVERS 87
-CONSTANT: EBADMACHO 88
-CONSTANT: ECANCELED 89
-CONSTANT: EIDRM 90
-CONSTANT: ENOMSG 91
-CONSTANT: EILSEQ 92
-CONSTANT: ENOATTR 93
-CONSTANT: EBADMSG 94
-CONSTANT: EMULTIHOP 95
-CONSTANT: ENODATA 96
-CONSTANT: ENOLINK 97
-CONSTANT: ENOSR 98
-CONSTANT: ENOSTR 99
-CONSTANT: EPROTO 100
-CONSTANT: ETIME 101
-CONSTANT: EOPNOTSUPP 102
-CONSTANT: ENOPOLICY 103
+++ /dev/null
-USING: alien.syntax alien.c-types math vocabs.loader
-classes.struct unix.types unix.time ;
-IN: unix.ffi
-
-CONSTANT: FD_SETSIZE 256
-
-STRUCT: addrinfo
- { flags int }
- { family int }
- { socktype int }
- { protocol int }
- { addrlen socklen_t }
- { canonname c-string }
- { addr void* }
- { next addrinfo* } ;
-
-STRUCT: dirent
- { d_fileno __uint32_t }
- { d_reclen __uint16_t }
- { d_type __uint8_t }
- { d_namlen __uint8_t }
- { d_name char[256] } ;
-
-CONSTANT: EPERM 1
-CONSTANT: ENOENT 2
-CONSTANT: ESRCH 3
-CONSTANT: EINTR 4
-CONSTANT: EIO 5
-CONSTANT: ENXIO 6
-CONSTANT: E2BIG 7
-CONSTANT: ENOEXEC 8
-CONSTANT: EBADF 9
-CONSTANT: ECHILD 10
-CONSTANT: EDEADLK 11
-CONSTANT: ENOMEM 12
-CONSTANT: EACCES 13
-CONSTANT: EFAULT 14
-CONSTANT: ENOTBLK 15
-CONSTANT: EBUSY 16
-CONSTANT: EEXIST 17
-CONSTANT: EXDEV 18
-CONSTANT: ENODEV 19
-CONSTANT: ENOTDIR 20
-CONSTANT: EISDIR 21
-CONSTANT: EINVAL 22
-CONSTANT: ENFILE 23
-CONSTANT: EMFILE 24
-CONSTANT: ENOTTY 25
-CONSTANT: ETXTBSY 26
-CONSTANT: EFBIG 27
-CONSTANT: ENOSPC 28
-CONSTANT: ESPIPE 29
-CONSTANT: EROFS 30
-CONSTANT: EMLINK 31
-CONSTANT: EPIPE 32
-CONSTANT: EDOM 33
-CONSTANT: ERANGE 34
-CONSTANT: EAGAIN 35
-ALIAS: EWOULDBLOCK EAGAIN
-CONSTANT: EINPROGRESS 36
-CONSTANT: EALREADY 37
-CONSTANT: ENOTSOCK 38
-CONSTANT: EDESTADDRREQ 39
-CONSTANT: EMSGSIZE 40
-CONSTANT: EPROTOTYPE 41
-CONSTANT: ENOPROTOOPT 42
-CONSTANT: EPROTONOSUPPORT 43
-CONSTANT: ESOCKTNOSUPPORT 44
-CONSTANT: EOPNOTSUPP 45
-CONSTANT: EPFNOSUPPORT 46
-CONSTANT: EAFNOSUPPORT 47
-CONSTANT: EADDRINUSE 48
-CONSTANT: EADDRNOTAVAIL 49
-CONSTANT: ENETDOWN 50
-CONSTANT: ENETUNREACH 51
-CONSTANT: ENETRESET 52
-CONSTANT: ECONNABORTED 53
-CONSTANT: ECONNRESET 54
-CONSTANT: ENOBUFS 55
-CONSTANT: EISCONN 56
-CONSTANT: ENOTCONN 57
-CONSTANT: ESHUTDOWN 58
-CONSTANT: ETOOMANYREFS 59
-CONSTANT: ETIMEDOUT 60
-CONSTANT: ECONNREFUSED 61
-CONSTANT: ELOOP 62
-CONSTANT: ENAMETOOLONG 63
-CONSTANT: EHOSTDOWN 64
-CONSTANT: EHOSTUNREACH 65
-CONSTANT: ENOTEMPTY 66
-CONSTANT: EPROCLIM 67
-CONSTANT: EUSERS 68
-CONSTANT: EDQUOT 69
-CONSTANT: ESTALE 70
-CONSTANT: EREMOTE 71
-CONSTANT: EBADRPC 72
-CONSTANT: ERPCMISMATCH 73
-CONSTANT: EPROGUNAVAIL 74
-CONSTANT: EPROGMISMATCH 75
-CONSTANT: EPROCUNAVAIL 76
-CONSTANT: ENOLCK 77
-CONSTANT: ENOSYS 78
-CONSTANT: EFTYPE 79
-CONSTANT: EAUTH 80
-CONSTANT: ENEEDAUTH 81
-CONSTANT: EIDRM 82
-CONSTANT: ENOMSG 83
-CONSTANT: EOVERFLOW 84
-CONSTANT: EILSEQ 85
-CONSTANT: ENOTSUP 86
-CONSTANT: ECANCELED 87
-CONSTANT: EBADMSG 88
-CONSTANT: ENODATA 89
-CONSTANT: ENOSR 90
-CONSTANT: ENOSTR 91
-CONSTANT: ETIME 92
-CONSTANT: ENOATTR 93
-CONSTANT: EMULTIHOP 94
-CONSTANT: ENOLINK 95
-CONSTANT: EPROTO 96
-CONSTANT: ELAST 96
-
-TYPEDEF: __uint8_t sa_family_t
-
-CONSTANT: _UTX_USERSIZE 32
-CONSTANT: _UTX_LINESIZE 32
-CONSTANT: _UTX_IDSIZE 4
-CONSTANT: _UTX_HOSTSIZE 256
-
-<<
-
-CONSTANT: _SS_MAXSIZE 128
-
-: _SS_ALIGNSIZE ( -- n )
- __int64_t heap-size ; inline
-
-: _SS_PAD1SIZE ( -- n )
- _SS_ALIGNSIZE 2 - ; inline
-
-: _SS_PAD2SIZE ( -- n )
- _SS_MAXSIZE 2 - _SS_PAD1SIZE - _SS_ALIGNSIZE - ; inline
-
->>
-
-STRUCT: sockaddr_storage
- { ss_len __uint8_t }
- { ss_family sa_family_t }
- { __ss_pad1 { char _SS_PAD1SIZE } }
- { __ss_align __int64_t }
- { __ss_pad2 { char _SS_PAD2SIZE } } ;
-
-STRUCT: exit_struct
- { e_termination uint16_t }
- { e_exit uint16_t } ;
-
-STRUCT: utmpx
- { ut_user { char _UTX_USERSIZE } }
- { ut_id { char _UTX_IDSIZE } }
- { ut_line { char _UTX_LINESIZE } }
- { ut_host { char _UTX_HOSTSIZE } }
- { ut_session uint16_t }
- { ut_type uint16_t }
- { ut_pid pid_t }
- { ut_exit exit_struct }
- { ut_ss sockaddr_storage }
- { ut_tv timeval }
- { ut_pad { uint32_t 10 } } ;
+++ /dev/null
-USING: alien.c-types alien.syntax classes.struct unix.types ;
-IN: unix.ffi
-
-CONSTANT: AF_INET6 24
-ALIAS: PF_INET6 AF_INET6
-
-CONSTANT: FD_SETSIZE 1024
-
-STRUCT: addrinfo
- { flags int }
- { family int }
- { socktype int }
- { protocol int }
- { addrlen socklen_t }
- { addr void* }
- { canonname c-string }
- { next addrinfo* } ;
-
-STRUCT: dirent
- { d_fileno __uint32_t }
- { d_reclen __uint16_t }
- { d_type __uint8_t }
- { d_namlen __uint8_t }
- { d_name char[256] } ;
-
-CONSTANT: EPERM 1
-CONSTANT: ENOENT 2
-CONSTANT: ESRCH 3
-CONSTANT: EINTR 4
-CONSTANT: EIO 5
-CONSTANT: ENXIO 6
-CONSTANT: E2BIG 7
-CONSTANT: ENOEXEC 8
-CONSTANT: EBADF 9
-CONSTANT: ECHILD 10
-CONSTANT: EDEADLK 11
-CONSTANT: ENOMEM 12
-CONSTANT: EACCES 13
-CONSTANT: EFAULT 14
-CONSTANT: ENOTBLK 15
-CONSTANT: EBUSY 16
-CONSTANT: EEXIST 17
-CONSTANT: EXDEV 18
-CONSTANT: ENODEV 19
-CONSTANT: ENOTDIR 20
-CONSTANT: EISDIR 21
-CONSTANT: EINVAL 22
-CONSTANT: ENFILE 23
-CONSTANT: EMFILE 24
-CONSTANT: ENOTTY 25
-CONSTANT: ETXTBSY 26
-CONSTANT: EFBIG 27
-CONSTANT: ENOSPC 28
-CONSTANT: ESPIPE 29
-CONSTANT: EROFS 30
-CONSTANT: EMLINK 31
-CONSTANT: EPIPE 32
-CONSTANT: EDOM 33
-CONSTANT: ERANGE 34
-CONSTANT: EAGAIN 35
-ALIAS: EWOULDBLOCK EAGAIN
-CONSTANT: EINPROGRESS 36
-CONSTANT: EALREADY 37
-CONSTANT: ENOTSOCK 38
-CONSTANT: EDESTADDRREQ 39
-CONSTANT: EMSGSIZE 40
-CONSTANT: EPROTOTYPE 41
-CONSTANT: ENOPROTOOPT 42
-CONSTANT: EPROTONOSUPPORT 43
-CONSTANT: ESOCKTNOSUPPORT 44
-CONSTANT: EOPNOTSUPP 45
-CONSTANT: EPFNOSUPPORT 46
-CONSTANT: EAFNOSUPPORT 47
-CONSTANT: EADDRINUSE 48
-CONSTANT: EADDRNOTAVAIL 49
-CONSTANT: ENETDOWN 50
-CONSTANT: ENETUNREACH 51
-CONSTANT: ENETRESET 52
-CONSTANT: ECONNABORTED 53
-CONSTANT: ECONNRESET 54
-CONSTANT: ENOBUFS 55
-CONSTANT: EISCONN 56
-CONSTANT: ENOTCONN 57
-CONSTANT: ESHUTDOWN 58
-CONSTANT: ETOOMANYREFS 59
-CONSTANT: ETIMEDOUT 60
-CONSTANT: ECONNREFUSED 61
-CONSTANT: ELOOP 62
-CONSTANT: ENAMETOOLONG 63
-CONSTANT: EHOSTDOWN 64
-CONSTANT: EHOSTUNREACH 65
-CONSTANT: ENOTEMPTY 66
-CONSTANT: EPROCLIM 67
-CONSTANT: EUSERS 68
-CONSTANT: EDQUOT 69
-CONSTANT: ESTALE 70
-CONSTANT: EREMOTE 71
-CONSTANT: EBADRPC 72
-CONSTANT: ERPCMISMATCH 73
-CONSTANT: EPROGUNAVAIL 74
-CONSTANT: EPROGMISMATCH 75
-CONSTANT: EPROCUNAVAIL 76
-CONSTANT: ENOLCK 77
-CONSTANT: ENOSYS 78
-CONSTANT: EFTYPE 79
-CONSTANT: EAUTH 80
-CONSTANT: ENEEDAUTH 81
-CONSTANT: EIPSEC 82
-CONSTANT: ENOATTR 83
-CONSTANT: EILSEQ 84
-CONSTANT: ENOMEDIUM 85
-CONSTANT: EMEDIUMTYPE 86
-CONSTANT: EOVERFLOW 87
-CONSTANT: ECANCELED 88
+++ /dev/null
-*BSD/Mac OS X support
{
{ [ os linux? ] [ "unix.ffi.linux" require ] }
- { [ os bsd? ] [ "unix.ffi.bsd" require ] }
- { [ os solaris? ] [ "unix.ffi.solaris" require ] }
+ { [ os macosx? ] [ "unix.ffi.macosx" require ] }
} cond
>>
--- /dev/null
+USING: alien alien.c-types alien.libraries alien.syntax
+classes.struct combinators kernel system unix unix.time
+unix.types vocabs vocabs.loader ;
+IN: unix.ffi
+
+CONSTANT: MAXPATHLEN 1024
+
+CONSTANT: O_RDONLY HEX: 0000
+CONSTANT: O_WRONLY HEX: 0001
+CONSTANT: O_RDWR HEX: 0002
+CONSTANT: O_NONBLOCK HEX: 0004
+CONSTANT: O_APPEND HEX: 0008
+CONSTANT: O_CREAT HEX: 0200
+CONSTANT: O_TRUNC HEX: 0400
+CONSTANT: O_EXCL HEX: 0800
+CONSTANT: O_NOCTTY HEX: 20000
+ALIAS: O_NDELAY O_NONBLOCK
+
+CONSTANT: SOL_SOCKET HEX: ffff
+CONSTANT: SO_REUSEADDR HEX: 4
+CONSTANT: SO_OOBINLINE HEX: 100
+CONSTANT: SO_SNDTIMEO HEX: 1005
+CONSTANT: SO_RCVTIMEO HEX: 1006
+
+CONSTANT: F_SETFD 2
+CONSTANT: F_SETFL 4
+CONSTANT: FD_CLOEXEC 1
+
+STRUCT: sockaddr-in
+ { len uchar }
+ { family uchar }
+ { port ushort }
+ { addr in_addr_t }
+ { unused longlong } ;
+
+STRUCT: sockaddr-in6
+ { len uchar }
+ { family uchar }
+ { port ushort }
+ { flowinfo uint }
+ { addr uchar[16] }
+ { scopeid uint } ;
+
+STRUCT: sockaddr-un
+ { len uchar }
+ { family uchar }
+ { path char[104] } ;
+
+STRUCT: passwd
+ { pw_name c-string }
+ { pw_passwd c-string }
+ { pw_uid uid_t }
+ { pw_gid gid_t }
+ { pw_change time_t }
+ { pw_class c-string }
+ { pw_gecos c-string }
+ { pw_dir c-string }
+ { pw_shell c-string }
+ { pw_expire time_t }
+ { pw_fields int } ;
+
+CONSTANT: max-un-path 104
+
+CONSTANT: SOCK_STREAM 1
+CONSTANT: SOCK_DGRAM 2
+CONSTANT: SOCK_RAW 3
+
+CONSTANT: AF_UNSPEC 0
+CONSTANT: AF_UNIX 1
+CONSTANT: AF_INET 2
+
+ALIAS: PF_UNSPEC AF_UNSPEC
+ALIAS: PF_UNIX AF_UNIX
+ALIAS: PF_INET AF_INET
+
+CONSTANT: IPPROTO_TCP 6
+CONSTANT: IPPROTO_UDP 17
+
+CONSTANT: AI_PASSIVE 1
+
+CONSTANT: SEEK_SET 0
+CONSTANT: SEEK_CUR 1
+CONSTANT: SEEK_END 2
+
+CONSTANT: FD_SETSIZE 1024
+
+CONSTANT: AF_INET6 30
+ALIAS: PF_INET6 AF_INET6
+
+STRUCT: addrinfo
+ { flags int }
+ { family int }
+ { socktype int }
+ { protocol int }
+ { addrlen socklen_t }
+ { canonname c-string }
+ { addr void* }
+ { next addrinfo* } ;
+
+CONSTANT: _UTX_USERSIZE 256
+CONSTANT: _UTX_LINESIZE 32
+CONSTANT: _UTX_IDSIZE 4
+CONSTANT: _UTX_HOSTSIZE 256
+
+STRUCT: utmpx
+ { ut_user { char _UTX_USERSIZE } }
+ { ut_id { char _UTX_IDSIZE } }
+ { ut_line { char _UTX_LINESIZE } }
+ { ut_pid pid_t }
+ { ut_type short }
+ { ut_tv timeval }
+ { ut_host { char _UTX_HOSTSIZE } }
+ { ut_pad { uint 16 } } ;
+
+CONSTANT: __DARWIN_MAXPATHLEN 1024
+CONSTANT: __DARWIN_MAXNAMELEN 255
+CONSTANT: __DARWIN_MAXNAMELEN+1 256
+
+STRUCT: dirent
+ { d_ino ino_t }
+ { d_reclen __uint16_t }
+ { d_type __uint8_t }
+ { d_namlen __uint8_t }
+ { d_name { char __DARWIN_MAXNAMELEN+1 } } ;
+
+CONSTANT: EPERM 1
+CONSTANT: ENOENT 2
+CONSTANT: ESRCH 3
+CONSTANT: EINTR 4
+CONSTANT: EIO 5
+CONSTANT: ENXIO 6
+CONSTANT: E2BIG 7
+CONSTANT: ENOEXEC 8
+CONSTANT: EBADF 9
+CONSTANT: ECHILD 10
+CONSTANT: EDEADLK 11
+CONSTANT: ENOMEM 12
+CONSTANT: EACCES 13
+CONSTANT: EFAULT 14
+CONSTANT: ENOTBLK 15
+CONSTANT: EBUSY 16
+CONSTANT: EEXIST 17
+CONSTANT: EXDEV 18
+CONSTANT: ENODEV 19
+CONSTANT: ENOTDIR 20
+CONSTANT: EISDIR 21
+CONSTANT: EINVAL 22
+CONSTANT: ENFILE 23
+CONSTANT: EMFILE 24
+CONSTANT: ENOTTY 25
+CONSTANT: ETXTBSY 26
+CONSTANT: EFBIG 27
+CONSTANT: ENOSPC 28
+CONSTANT: ESPIPE 29
+CONSTANT: EROFS 30
+CONSTANT: EMLINK 31
+CONSTANT: EPIPE 32
+CONSTANT: EDOM 33
+CONSTANT: ERANGE 34
+CONSTANT: EAGAIN 35
+ALIAS: EWOULDBLOCK EAGAIN
+CONSTANT: EINPROGRESS 36
+CONSTANT: EALREADY 37
+CONSTANT: ENOTSOCK 38
+CONSTANT: EDESTADDRREQ 39
+CONSTANT: EMSGSIZE 40
+CONSTANT: EPROTOTYPE 41
+CONSTANT: ENOPROTOOPT 42
+CONSTANT: EPROTONOSUPPORT 43
+CONSTANT: ESOCKTNOSUPPORT 44
+CONSTANT: ENOTSUP 45
+CONSTANT: EPFNOSUPPORT 46
+CONSTANT: EAFNOSUPPORT 47
+CONSTANT: EADDRINUSE 48
+CONSTANT: EADDRNOTAVAIL 49
+CONSTANT: ENETDOWN 50
+CONSTANT: ENETUNREACH 51
+CONSTANT: ENETRESET 52
+CONSTANT: ECONNABORTED 53
+CONSTANT: ECONNRESET 54
+CONSTANT: ENOBUFS 55
+CONSTANT: EISCONN 56
+CONSTANT: ENOTCONN 57
+CONSTANT: ESHUTDOWN 58
+CONSTANT: ETOOMANYREFS 59
+CONSTANT: ETIMEDOUT 60
+CONSTANT: ECONNREFUSED 61
+CONSTANT: ELOOP 62
+CONSTANT: ENAMETOOLONG 63
+CONSTANT: EHOSTDOWN 64
+CONSTANT: EHOSTUNREACH 65
+CONSTANT: ENOTEMPTY 66
+CONSTANT: EPROCLIM 67
+CONSTANT: EUSERS 68
+CONSTANT: EDQUOT 69
+CONSTANT: ESTALE 70
+CONSTANT: EREMOTE 71
+CONSTANT: EBADRPC 72
+CONSTANT: ERPCMISMATCH 73
+CONSTANT: EPROGUNAVAIL 74
+CONSTANT: EPROGMISMATCH 75
+CONSTANT: EPROCUNAVAIL 76
+CONSTANT: ENOLCK 77
+CONSTANT: ENOSYS 78
+CONSTANT: EFTYPE 79
+CONSTANT: EAUTH 80
+CONSTANT: ENEEDAUTH 81
+CONSTANT: EPWROFF 82
+CONSTANT: EDEVERR 83
+CONSTANT: EOVERFLOW 84
+CONSTANT: EBADEXEC 85
+CONSTANT: EBADARCH 86
+CONSTANT: ESHLIBVERS 87
+CONSTANT: EBADMACHO 88
+CONSTANT: ECANCELED 89
+CONSTANT: EIDRM 90
+CONSTANT: ENOMSG 91
+CONSTANT: EILSEQ 92
+CONSTANT: ENOATTR 93
+CONSTANT: EBADMSG 94
+CONSTANT: EMULTIHOP 95
+CONSTANT: ENODATA 96
+CONSTANT: ENOLINK 97
+CONSTANT: ENOSR 98
+CONSTANT: ENOSTR 99
+CONSTANT: EPROTO 100
+CONSTANT: ETIME 101
+CONSTANT: EOPNOTSUPP 102
+CONSTANT: ENOPOLICY 103
+++ /dev/null
-Slava Pestov
+++ /dev/null
-! Copyright (C) 2006 Patrick Mauritz.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax system kernel layouts ;
-IN: unix.ffi
-
-! Solaris.
-
-CONSTANT: O_RDONLY HEX: 0000
-CONSTANT: O_WRONLY HEX: 0001
-CONSTANT: O_RDWR HEX: 0002
-CONSTANT: O_APPEND HEX: 0008
-CONSTANT: O_CREAT HEX: 0100
-CONSTANT: O_TRUNC HEX: 0200
-
-CONSTANT: SEEK_END 2
-
-CONSTANT: SOL_SOCKET HEX: ffff
-
-: FD_SETSIZE ( -- n ) cell 4 = 1024 65536 ? ;
-
-CONSTANT: SO_REUSEADDR 4
-CONSTANT: SO_OOBINLINE HEX: 0100
-CONSTANT: SO_SNDTIMEO HEX: 1005
-CONSTANT: SO_RCVTIMEO HEX: 1006
-
-CONSTANT: F_SETFL 4 ! set file status flags
-CONSTANT: O_NONBLOCK HEX: 80 ! no delay
-
-STRUCT: addrinfo
- { flags int }
- { family int }
- { socktype int }
- { protocol int }
-! #ifdef __sparcv9
-! int _ai_pad;
-! #endif
- { addrlen int }
- { canonname c-string }
- { addr void* }
- { next void* } ;
-
-STRUCT: sockaddr-in
- { family ushort }
- { port ushort }
- { addr in_addr_t }
- { unused longlong } ;
-
-STRUCT: sockaddr-in6
- { family ushort }
- { port ushort }
- { flowinfo uint }
- { addr uchar[16] }
- { scopeid uint } ;
-
-CONSTANT: max-un-path 108
-
-STRUCT: sockaddr-un
- { family ushort }
- { path { "char" max-un-path } } ;
-
-CONSTANT: EINTR 4
-CONSTANT: EAGAIN 11
-CONSTANT: EINPROGRESS 150
-
-CONSTANT: SOCK_STREAM 2
-CONSTANT: SOCK_DGRAM 1
-
-CONSTANT: AF_UNSPEC 0
-CONSTANT: AF_UNIX 1
-CONSTANT: AF_INET 2
-CONSTANT: AF_INET6 26
-
-ALIAS: PF_UNSPEC AF_UNSPEC
-ALIAS: PF_UNIX AF_UNIX
-ALIAS: PF_INET AF_INET
-ALIAS: PF_INET6 AF_INET6
-
-CONSTANT: IPPROTO_TCP 6
-CONSTANT: IPPROTO_UDP 17
-
-CONSTANT: AI_PASSIVE 8
+++ /dev/null
-Doug Coleman
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax unix.statfs.freebsd ;
-IN: unix.getfsstat.freebsd
-
-CONSTANT: MNT_WAIT 1 ! synchronously wait for I/O to complete
-CONSTANT: MNT_NOWAIT 2 ! start all I/O, but do not wait for it
-CONSTANT: MNT_LAZY 3 ! push data not written by filesystem syncer
-CONSTANT: MNT_SUSPEND 4 ! Suspend file system after sync
-
-FUNCTION: int getfsstat ( statfs* buf, int bufsize, int flags ) ;
+++ /dev/null
-Doug Coleman
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax unix.statvfs.netbsd ;
-IN: unix.getfsstat.netbsd
-
-CONSTANT: MNT_WAIT 1 ! synchronously wait for I/O to complete
-CONSTANT: MNT_NOWAIT 2 ! start all I/O, but do not wait for it
-CONSTANT: MNT_LAZY 3 ! push data not written by filesystem syncer
-
-FUNCTION: int getvfsstat ( statvfs* buf, int bufsize, int flags ) ;
+++ /dev/null
-Doug Coleman
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax unix.statfs.openbsd ;
-IN: unix.getfsstat.openbsd
-
-CONSTANT: MNT_WAIT 1 ! synchronously wait for I/O to complete
-CONSTANT: MNT_NOWAIT 2 ! start all I/O, but do not wait for it
-CONSTANT: MNT_LAZY 3 ! push data not written by filesystem syncer
-
-FUNCTION: int getfsstat ( statfs* buf, int bufsize, int flags ) ;
+++ /dev/null
-USING: alien.c-types alien.syntax classes.struct unix.time ;
-IN: unix.kqueue
-
-STRUCT: kevent
- { ident ulong }
- { filter short }
- { flags ushort }
- { fflags uint }
- { data long }
- { udata void* } ;
-
-FUNCTION: int kevent ( int kq, kevent* changelist, int nchanges, kevent* eventlist, int nevents, timespec* timeout ) ;
-
-CONSTANT: EVFILT_READ -1
-CONSTANT: EVFILT_WRITE -2
-CONSTANT: EVFILT_AIO -3 ! attached to aio requests
-CONSTANT: EVFILT_VNODE -4 ! attached to vnodes
-CONSTANT: EVFILT_PROC -5 ! attached to struct proc
-CONSTANT: EVFILT_SIGNAL -6 ! attached to struct proc
-CONSTANT: EVFILT_TIMER -7 ! timers
-CONSTANT: EVFILT_NETDEV -8 ! Mach ports
-CONSTANT: EVFILT_FS -9 ! Filesystem events
+++ /dev/null
-USING: alien.c-types alien.syntax classes.struct unix.time ;
-IN: unix.kqueue
-
-STRUCT: kevent
- { ident ulong }
- { filter uint }
- { flags uint }
- { fflags uint }
- { data longlong }
- { udata void* } ;
-
-FUNCTION: int kevent ( int kq, kevent* changelist, size_t nchanges, kevent* eventlist, size_t nevents, timespec* timeout ) ;
-
-CONSTANT: EVFILT_READ 0
-CONSTANT: EVFILT_WRITE 1
-CONSTANT: EVFILT_AIO 2 ! attached to aio requests
-CONSTANT: EVFILT_VNODE 3 ! attached to vnodes
-CONSTANT: EVFILT_PROC 4 ! attached to struct proc
-CONSTANT: EVFILT_SIGNAL 5 ! attached to struct proc
-CONSTANT: EVFILT_TIMER 6 ! timers
-CONSTANT: EVFILT_SYSCOUNT 7 ! Filesystem events
+++ /dev/null
-USING: alien.c-types alien.syntax classes.struct unix.time ;
-IN: unix.kqueue
-
-STRUCT: kevent
- { ident uint }
- { filter short }
- { flags ushort }
- { fflags uint }
- { data int }
- { udata void* } ;
-
-FUNCTION: int kevent ( int kq, kevent* changelist, int nchanges, kevent* eventlist, int nevents, timespec* timeout ) ;
-
-CONSTANT: EVFILT_READ -1
-CONSTANT: EVFILT_WRITE -2
-CONSTANT: EVFILT_AIO -3 ! attached to aio requests
-CONSTANT: EVFILT_VNODE -4 ! attached to vnodes
-CONSTANT: EVFILT_PROC -5 ! attached to struct proc
-CONSTANT: EVFILT_SIGNAL -6 ! attached to struct proc
-CONSTANT: EVFILT_TIMER -7 ! timers
+++ /dev/null
-USING: kernel alien.c-types alien.syntax math classes.struct
-unix.time unix.types ;
-IN: unix.stat
-
-! FreeBSD 8.0-CURRENT
-
-STRUCT: stat
- { st_dev __dev_t }
- { st_ino ino_t }
- { st_mode mode_t }
- { st_nlink nlink_t }
- { st_uid uid_t }
- { st_gid gid_t }
- { st_rdev __dev_t }
- { st_atimespec timespec }
- { st_mtimespec timespec }
- { st_ctimespec timespec }
- { st_size off_t }
- { st_blocks blkcnt_t }
- { st_blksize blksize_t }
- { st_flags fflags_t }
- { st_gen __uint32_t }
- { st_lspare __int32_t }
- { st_birthtimespec timespec }
- { pad0 __int32_t[2] } ;
-
-FUNCTION: int stat ( c-string pathname, stat* buf ) ;
-FUNCTION: int lstat ( c-string pathname, stat* buf ) ;
-FUNCTION: int fstat ( int fd, stat* buf ) ;
+++ /dev/null
-USING: kernel alien.c-types alien.syntax math classes.struct
-unix.time unix.types ;
-IN: unix.stat
-
-! NetBSD 4.0
-
-STRUCT: stat
- { st_dev dev_t }
- { st_mode mode_t }
- { st_ino ino_t }
- { st_nlink nlink_t }
- { st_uid uid_t }
- { st_gid gid_t }
- { st_rdev dev_t }
- { st_atimespec timespec }
- { st_mtimespec timespec }
- { st_ctimespec timespec }
- { st_birthtimespec timespec }
- { st_size off_t }
- { st_blocks blkcnt_t }
- { st_blksize blksize_t }
- { st_flags uint32_t }
- { st_gen uint32_t }
- { st_qspare uint32_t[2] } ;
-
-FUNCTION: int __stat30 ( c-string pathname, stat* buf ) ;
-FUNCTION: int __lstat30 ( c-string pathname, stat* buf ) ;
-FUNCTION: int __fstat30 ( int fd, stat* buf ) ;
-
-: stat ( pathname buf -- n ) __stat30 ;
-: lstat ( pathname buf -- n ) __lstat30 ;
-: fstat ( fd buf -- n ) __fstat30 ;
+++ /dev/null
-not loaded
+++ /dev/null
-USING: kernel alien.c-types alien.syntax math classes.struct
-unix.time unix.types ;
-IN: unix.stat
-
-! NetBSD 4.0
-
-STRUCT: stat
- { st_dev dev_t }
- { st_ino ino_t }
- { st_mode mode_t }
- { st_nlink nlink_t }
- { st_uid uid_t }
- { st_gid gid_t }
- { st_rdev dev_t }
- { st_atimespec timespec }
- { st_mtimespec timespec }
- { st_ctimespec timespec }
- { st_size off_t }
- { st_blocks blkcnt_t }
- { st_blksize blksize_t }
- { st_flags uint32_t }
- { st_gen uint32_t }
- { st_spare0 uint32_t }
- { st_birthtimespec timespec } ;
-
-FUNCTION: int __stat13 ( c-string pathname, stat* buf ) ;
-FUNCTION: int __lstat13 ( c-string pathname, stat* buf ) ;
-FUNCTION: int __fstat13 ( int fd, stat* buf ) ;
-
-: stat ( pathname buf -- n ) __stat13 ;
-: lstat ( pathname buf -- n ) __lstat13 ;
-: fstat ( fd buf -- n ) __fstat13 ;
+++ /dev/null
-not loaded
+++ /dev/null
-USING: layouts combinators vocabs alien.syntax ;
-IN: unix.stat
-
-cell-bits {
- { 32 [ "unix.stat.netbsd.32" require ] }
- { 64 [ "unix.stat.netbsd.64" require ] }
-} case
-
+++ /dev/null
-USING: kernel alien.c-types alien.syntax math classes.struct
-unix.time unix.types ;
-IN: unix.stat
-
-! OpenBSD 4.2
-
-STRUCT: stat
- { st_dev dev_t }
- { st_ino ino_t }
- { st_mode mode_t }
- { st_nlink nlink_t }
- { st_uid uid_t }
- { st_gid gid_t }
- { st_rdev dev_t }
- { st_lspare0 int32_t }
- { st_atimespec timespec }
- { st_mtimespec timespec }
- { st_ctimespec timespec }
- { st_size off_t }
- { st_blocks int64_t }
- { st_blksize u_int32_t }
- { st_flags u_int32_t }
- { st_gen u_int32_t }
- { st_lspare1 int32_t }
- { st_birthtimespec timespec }
- { st_qspare int64_t[2] } ;
-
-FUNCTION: int stat ( c-string pathname, stat* buf ) ;
-FUNCTION: int lstat ( c-string pathname, stat* buf ) ;
-FUNCTION: int fstat ( int fd, stat* buf ) ;
<< os {
{ linux [ "unix.stat.linux" require ] }
{ macosx [ "unix.stat.macosx" require ] }
- { freebsd [ "unix.stat.freebsd" require ] }
- { netbsd [ "unix.stat.netbsd" require ] }
- { openbsd [ "unix.stat.openbsd" require ] }
} case >>
: file-status ( pathname -- stat )
+++ /dev/null
-Doug Coleman
\ No newline at end of file
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax alien.c-types unix.types unix.stat classes.struct ;
-IN: unix.statfs.freebsd
-
-CONSTANT: MFSNAMELEN 16 ! length of type name including null */
-CONSTANT: MNAMELEN 88 ! size of on/from name bufs
-CONSTANT: STATFS_VERSION HEX: 20030518 ! current version number
-
-STRUCT: statfs
- { f_version uint32_t }
- { f_type uint32_t }
- { f_flags uint64_t }
- { f_bsize uint64_t }
- { f_iosize uint64_t }
- { f_blocks uint64_t }
- { f_bfree uint64_t }
- { f_bavail int64_t }
- { f_files uint64_t }
- { f_ffree int64_t }
- { f_syncwrites uint64_t }
- { f_asyncwrites uint64_t }
- { f_syncreads uint64_t }
- { f_asyncreads uint64_t }
- { f_spare uint64_t[10] }
- { f_namemax uint32_t }
- { f_owner uid_t }
- { f_fsid fsid_t }
- { f_charspare char[80] }
- { f_fstypename { char MFSNAMELEN } }
- { f_mntfromname { char MNAMELEN } }
- { f_mntonname { char MNAMELEN } } ;
-
-FUNCTION: int statfs ( c-string path, statfs* buf ) ;
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax unix.types classes.struct
-unix.stat ;
-IN: unix.statfs.openbsd
-
-CONSTANT: MFSNAMELEN 16
-CONSTANT: MNAMELEN 90
-
-STRUCT: statfs
- { f_flags u_int32_t }
- { f_bsize u_int32_t }
- { f_iosize u_int32_t }
- { f_blocks u_int64_t }
- { f_bfree u_int64_t }
- { f_bavail int64_t }
- { f_files u_int64_t }
- { f_ffree u_int64_t }
- { f_favail int64_t }
- { f_syncwrites u_int64_t }
- { f_syncreads u_int64_t }
- { f_asyncwrites u_int64_t }
- { f_asyncreads u_int64_t }
- { f_fsid fsid_t }
- { f_namemax u_int32_t }
- { f_owner uid_t }
- { f_ctime u_int32_t }
- { f_spare u_int32_t[3] }
- { f_fstypename { char MFSNAMELEN } }
- { f_mntonname { char MNAMELEN } }
- { f_mntfromname { char MNAMELEN } }
- { mount_info char[160] } ;
-
-FUNCTION: int statfs ( c-string path, statfs* buf ) ;
+++ /dev/null
-Doug Coleman
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax classes.struct unix.types ;
-IN: unix.statvfs.freebsd
-
-STRUCT: statvfs
- { f_bavail fsblkcnt_t }
- { f_bfree fsblkcnt_t }
- { f_blocks fsblkcnt_t }
- { f_favail fsfilcnt_t }
- { f_ffree fsfilcnt_t }
- { f_files fsfilcnt_t }
- { f_bsize ulong }
- { f_flag ulong }
- { f_frsize ulong }
- { f_fsid ulong }
- { f_namemax ulong } ;
-
-! Flags
-CONSTANT: ST_RDONLY HEX: 1 ! Read-only file system
-CONSTANT: ST_NOSUID HEX: 2 ! Does not honor setuid/setgid
-
-FUNCTION: int statvfs ( c-string path, statvfs* buf ) ;
+++ /dev/null
-Doug Coleman
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax classes.struct unix.types
-unix.stat ;
-IN: unix.statvfs.netbsd
-
-CONSTANT: _VFS_NAMELEN 32
-CONSTANT: _VFS_MNAMELEN 1024
-
-STRUCT: statvfs
- { f_flag ulong }
- { f_bsize ulong }
- { f_frsize ulong }
- { f_iosize ulong }
- { f_blocks fsblkcnt_t }
- { f_bfree fsblkcnt_t }
- { f_bavail fsblkcnt_t }
- { f_bresvd fsblkcnt_t }
- { f_files fsfilcnt_t }
- { f_ffree fsfilcnt_t }
- { f_favail fsfilcnt_t }
- { f_fresvd fsfilcnt_t }
- { f_syncreads uint64_t }
- { f_syncwrites uint64_t }
- { f_asyncreads uint64_t }
- { f_asyncwrites uint64_t }
- { f_fsidx fsid_t }
- { f_fsid ulong }
- { f_namemax ulong }
- { f_owner uid_t }
- { f_spare uint32_t[4] }
- { f_fstypename { char _VFS_NAMELEN } }
- { f_mntonname { char _VFS_MNAMELEN } }
- { f_mntfromname { char _VFS_MNAMELEN } } ;
-
-FUNCTION: int statvfs ( c-string path, statvfs* buf ) ;
+++ /dev/null
-Doug Coleman
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax classes.struct unix.types ;
-IN: unix.statvfs.openbsd
-
-STRUCT: statvfs
- { f_bsize ulong }
- { f_frsize ulong }
- { f_blocks fsblkcnt_t }
- { f_bfree fsblkcnt_t }
- { f_bavail fsblkcnt_t }
- { f_files fsfilcnt_t }
- { f_ffree fsfilcnt_t }
- { f_favail fsfilcnt_t }
- { f_fsid ulong }
- { f_flag ulong }
- { f_namemax ulong } ;
-
-CONSTANT: ST_RDONLY 1
-CONSTANT: ST_NOSUID 2
-
-FUNCTION: int statvfs ( c-string path, statvfs* buf ) ;
os {
{ linux [ "unix.statvfs.linux" require ] }
{ macosx [ "unix.statvfs.macosx" require ] }
- { freebsd [ "unix.statvfs.freebsd" require ] }
- { netbsd [ "unix.statvfs.netbsd" require ] }
- { openbsd [ "unix.statvfs.openbsd" require ] }
} case
+++ /dev/null
-USING: alien.syntax alien.c-types ;
-
-IN: unix.types
-
-! FreeBSD 7 x86.32
-
-TYPEDEF: ushort __uint16_t
-TYPEDEF: uint __uint32_t
-TYPEDEF: int __int32_t
-TYPEDEF: longlong __int64_t
-
-TYPEDEF: __uint32_t __dev_t
-TYPEDEF: __uint32_t ino_t
-TYPEDEF: __uint16_t mode_t
-TYPEDEF: __uint16_t nlink_t
-TYPEDEF: __uint32_t uid_t
-TYPEDEF: __uint32_t gid_t
-TYPEDEF: __int64_t off_t
-TYPEDEF: __int64_t blkcnt_t
-TYPEDEF: __uint32_t blksize_t
-TYPEDEF: __uint32_t fflags_t
-TYPEDEF: long ssize_t
-TYPEDEF: int pid_t
-TYPEDEF: long time_t
+++ /dev/null
-USING: alien.syntax ;
-IN: unix.types
-
-! NetBSD 4.0
-
-TYPEDEF: __uint64_t ino_t
+++ /dev/null
-not loaded
+++ /dev/null
-USING: alien.syntax ;
-IN: unix.types
-
-! NetBSD 4.0
-
-TYPEDEF: __uint32_t ino_t
+++ /dev/null
-not loaded
+++ /dev/null
-USING: alien.syntax alien.c-types combinators layouts vocabs ;
-IN: unix.types
-
-! NetBSD 4.0
-
-TYPEDEF: __uint32_t __dev_t
-TYPEDEF: __uint32_t dev_t
-TYPEDEF: __uint32_t mode_t
-TYPEDEF: __uint32_t nlink_t
-TYPEDEF: __uint32_t uid_t
-TYPEDEF: __uint32_t __uid_t
-TYPEDEF: __uint32_t gid_t
-TYPEDEF: __int64_t off_t
-TYPEDEF: __int64_t blkcnt_t
-TYPEDEF: __uint32_t blksize_t
-TYPEDEF: long ssize_t
-TYPEDEF: int pid_t
-TYPEDEF: int time_t
-
-cell-bits {
- { 32 [ "unix.types.netbsd.32" require ] }
- { 64 [ "unix.types.netbsd.64" require ] }
-} case
-
+++ /dev/null
-USING: alien.syntax alien.c-types ;
-IN: unix.types
-
-! OpenBSD 4.2
-
-TYPEDEF: __uint32_t __dev_t
-TYPEDEF: __uint32_t dev_t
-TYPEDEF: __uint32_t ino_t
-TYPEDEF: __uint32_t mode_t
-TYPEDEF: __uint32_t nlink_t
-TYPEDEF: __uint32_t uid_t
-TYPEDEF: __uint32_t gid_t
-TYPEDEF: __int64_t off_t
-TYPEDEF: __int64_t blkcnt_t
-TYPEDEF: __uint32_t blksize_t
-TYPEDEF: __uint32_t fflags_t
-TYPEDEF: long ssize_t
-TYPEDEF: int pid_t
-TYPEDEF: int time_t
os {
{ linux [ "unix.types.linux" require ] }
{ macosx [ "unix.types.macosx" require ] }
- { freebsd [ "unix.types.freebsd" require ] }
- { openbsd [ "unix.types.openbsd" require ] }
- { netbsd [ "unix.types.netbsd" require ] }
} case
+++ /dev/null
-Doug Coleman
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: combinators accessors kernel unix.users
-system ;
-IN: unix.users.bsd
-QUALIFIED: unix
-
-TUPLE: bsd-passwd < passwd change class expire fields ;
-
-M: bsd new-passwd ( -- bsd-passwd ) bsd-passwd new ;
-
-M: bsd passwd>new-passwd ( passwd -- bsd-passwd )
- [ call-next-method ] keep
- {
- [ pw_change>> >>change ]
- [ pw_class>> >>class ]
- [ pw_shell>> >>shell ]
- [ pw_expire>> >>expire ]
- [ pw_fields>> >>fields ]
- } cleave ;
--- /dev/null
+Doug Coleman
--- /dev/null
+! Copyright (C) 2008 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: combinators accessors kernel unix.users
+system ;
+IN: unix.users.macosx
+
+TUPLE: macosx-passwd < passwd change class expire fields ;
+
+M: macosx new-passwd ( -- macosx-passwd ) macosx-passwd new ;
+
+M: macosx passwd>new-passwd ( passwd -- macosx-passwd )
+ [ call-next-method ] keep
+ {
+ [ pw_change>> >>change ]
+ [ pw_class>> >>class ]
+ [ pw_shell>> >>shell ]
+ [ pw_expire>> >>expire ]
+ [ pw_fields>> >>fields ]
+ } cleave ;
?user-id (set-effective-user) ;
os {
- { [ dup bsd? ] [ drop "unix.users.bsd" require ] }
+ { [ dup macosx? ] [ drop "unix.users.macosx" require ] }
{ [ dup linux? ] [ drop ] }
} cond
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax unix.ffi.bsd.macosx ;
+USING: alien.syntax unix.ffi.macosx ;
IN: unix.utmpx.macosx
! empty
+++ /dev/null
-Doug Coleman
\ No newline at end of file
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test unix.utmpx.netbsd ;
-IN: unix.utmpx.netbsd.tests
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax unix unix.utmpx unix.ffi.bsd.netbsd accessors
-system kernel combinators ;
-IN: unix.utmpx.netbsd
-
-TUPLE: netbsd-utmpx-record < utmpx-record
-termination exit sockaddr ;
-
-M: netbsd new-utmpx-record ( -- utmpx-record )
- netbsd-utmpx-record new ;
-
-M: netbsd utmpx>utmpx-record ( utmpx -- record )
- [ new-utmpx-record ] dip
- [
- ut_exit>>
- [ e_termination>> >>termination ]
- [ e_exit>> >>exit ] bi
- ]
- [ ut_ss>> >>sockaddr ] bi ;
os {
{ macosx [ "unix.utmpx.macosx" require ] }
- { netbsd [ "unix.utmpx.netbsd" require ] }
} case
set_gcc() {
case $OS in
- openbsd) ensure_program_installed egcc; CC=egcc;;
+ macosx)
+ if xcodebuild -version | grep 'Xcode 4' >/dev/null; then
+ CC=clang
+ else
+ CC=gcc
+ fi
+ ;;
*) CC=gcc;;
esac
}
set_make() {
- case $OS in
- netbsd) MAKE='gmake';;
- freebsd) MAKE='gmake';;
- openbsd) MAKE='gmake';;
- dragonflybsd) MAKE='gmake';;
- *) MAKE='make';;
- esac
- if [[ $MAKE = 'gmake' ]] ; then
- ensure_program_installed gmake
- fi
+ MAKE='make'
}
check_installed_programs() {
*Darwin*) OS=macosx;;
*linux*) OS=linux;;
*Linux*) OS=linux;;
- *NetBSD*) OS=netbsd;;
- *FreeBSD*) OS=freebsd;;
- *OpenBSD*) OS=openbsd;;
- *DragonFly*) OS=dragonflybsd;;
- SunOS) OS=solaris;;
+ *BSD*)
+ echo "Here's a nickel, kid:"
+ echo " ..;;iiiittttjjttttii;;........ "
+ echo " ..ttLLGGGGffttjjjjttttttjjjjtt;;.... "
+ echo " ..iiLLLLjjffffiiiiffttLLjjiiiiiiiiffjjii.... "
+ echo " ;;LLttii;;iiiittttiiiittttffLLGGiiii;;iiLLLL;;.. "
+ echo " ..iiGGii..ii;;iiiittiittiiiiiittffffGGtt;;;;;;ffDDii.. "
+ echo " iiDD;;;;..;;ttttiittiittttiiiittttffDDEE;;,,;;;;ffKKtt.. "
+ echo " iiKKii..,,..iiii;;ii;;iittttttttttjjjjffGGLL::....;;LLWWtt.. "
+ echo " ..DDff..;;ii;;ii::,,;;;;iiiittttttjjffttjjLLDDtt..iiii;;KKWWii.. "
+ echo " LLLL;;;;ii;;;;;;,,;;;;;;ii;;ttttffffttttttLLGGKK..iiiiiiiiWWDD;; "
+ echo " ;;DD;;;;ii;;;;;;;;,,;;;;iiiiiiiijjffffffttttLLGGWWii..iiiiiiGG##jj.. "
+ echo " LLtt::ii;;....ii::;;,,;;;;iiiittttLLLLLLttttttGGKKGG;;;;iiiiii##KK;; "
+ echo " ..LL..iiii;;::::;;;;,,,,;;;;ii;;ttiiDDLLtttt;;iittLL##ii;;iiii;;WW##tt.. "
+ echo " ii;;;;iiff ..;;..ii..;;;;;;ii;;iiiiDDLLiiii;;ttLLEE##tt;;;;ii;;DD##GG.. "
+ echo " tt..iiGG::....ii..;;;;;;;;;;;;;;iiiiDDLLiiiiiiffGGWWKKiiii;;ii..tt##KK;; "
+ echo " ff;;GGtt..,, tt..;;;;,,;;iiii;;iittGGLLttffLLGGKKDDjjLLii;;;;,,ii##WWii "
+ echo " GGttii..;;.. ff::;;..;;iiiitt..iiiittGGffLLEEffEE;;;;EEtt;;::..;;WW##tt "
+ echo " GGjjii..ii..,,ff..::;;iiiiiitt..;;iiffttttffGGWWKKiiiiLLDD..;;....WW##tt "
+ echo " GGff,,..ii..iiii,,..::iiiiii;;..;;jjjjiiiiffGG##DDttiiffKK;;.. ..WW##jj "
+ echo " GGff..;;;;..LL..;;;;..;;iiii..;;ttLLiiiiiiffGGKKEE..jjLLKKjj.. ..WW##tt "
+ echo " LLff..ii..iiGG..::......;;;;;;;;LL;;iittttttLLKKLLffKKLLKKff.. ;;####ii "
+ echo " LLjj..;; LLii;;..;;......;;;;iitt;;ttLLttiiGGGGGGffDDKKii::.. tt##WW;; "
+ echo " jjtt....;;GGttjj ......;;ii;;iitt;;ttffttttLLDDGGttDDKK;;.. LL##KK.. "
+ echo " ;;ii;;..LLtt;;;; ....;;ii....iiGG;;iijjffLLGGKKjjGGKKGG.... KK##LL "
+ echo " ..ffiittttiiii;; ....;;ii,,;;ttLLttiittjjLLGGttjjGGKKtt iiWW##ii "
+ echo " ttLLii;;iiii;; ....,,;; ..;;ttDDiiiiffffffffGGGGGG.. GG##KK.. "
+ echo " ..LLjjii;;;;....::;;,,;;;;..;;ttDDttttjjttffLLLLDDff ;;WW##tt "
+ echo " iiGGii,,....,,iiiiii,,ii ::ttEEttffDDttLLttLLKKii GG##KK.. "
+ echo " LLtt......,,;;;;;;iiiiii;;;;KKffLLKK;;;;tttttt tt##WWii "
+ echo " ..ii;;;;..;;iiii;;tt,,jj iiGGffLLKK....;;.... ;;WW##ff.. "
+ echo " ..;;..::;;iiiiii;;..jj;;..GGttffEE........ iiKK##LL.. "
+ echo " ..,,..;;;;;;;;..;;iitt,,ttttjjLL iiKK##LL.. "
+ echo " ............ ,,;;;;..;;;;LLii ..ttKKKKtt.. "
+ echo " ..::........;;......;;;;;; ..iiDDWWLL,, "
+ echo " ....;;................iittGGDDff;; "
+ echo " ....;;;;;;;;;;iiiiii::.. "
+ echo "Get yourself a real OS."
+ echo "http://www.microsoft.com/"
+ exit_script 1
esac
}
get_url http://downloads.factorcode.org/images/latest/checksums.txt
factorcode_md5=`cat checksums.txt|grep $BOOT_IMAGE|cut -f2 -d' '`;
set_md5sum
- case $OS in
- netbsd) disk_md5=`md5 $BOOT_IMAGE | cut -f4 -d' '`;;
- *) disk_md5=`$MD5SUM $BOOT_IMAGE|cut -f1 -d' '` ;;
- esac
+ disk_md5=`$MD5SUM $BOOT_IMAGE|cut -f1 -d' '` ;;
$ECHO "Factorcode md5: $factorcode_md5";
$ECHO "Disk md5: $disk_md5";
if [[ "$factorcode_md5" == "$disk_md5" ]] ; then
: overflow-c ( -- ) overflow-c overflow-c ;
-! The VM cannot recover from callstack overflow on Windows or
-! OpenBSD, because no facility exists to run memory protection
+! The VM cannot recover from callstack overflow on Windows,
+! because no facility exists to run memory protection
! fault handlers on an alternate callstack.
-os [ windows? ] [ openbsd? ] bi or [
+os windows? [
[ overflow-c ] [ { "kernel-error" 15 f f } = ] must-fail-with
] unless
{ $subsections os }
"Supported operating systems:"
{ $subsections
- freebsd
linux
macosx
- openbsd
- netbsd
- solaris
windows
}
"Operating system families:"
{ $subsections
- bsd
unix
windows
} ;
: cpu ( -- class ) \ cpu get-global ; foldable
-SINGLETON: windows
+SINGLETONS: windows macosx linux ;
-SINGLETONS: freebsd netbsd openbsd solaris macosx linux ;
-
-SINGLETON: haiku
-
-UNION: bsd freebsd netbsd openbsd macosx ;
-
-UNION: unix bsd solaris linux haiku ;
+UNION: unix macosx linux ;
: os ( -- class ) \ os get-global ; foldable
: string>os ( str -- class )
H{
{ "windows" windows }
- { "freebsd" freebsd }
- { "netbsd" netbsd }
- { "openbsd" openbsd }
- { "solaris" solaris }
{ "macosx" macosx }
{ "linux" linux }
- { "haiku" haiku }
} at ;
PRIVATE>
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax kernel math.bitwise sequences system io.serial
-literals ;
-IN: io.serial.unix
-
-M: bsd lookup-baud ( m -- n )
- dup {
- 0 50 75 110 134 150 200 300 600 1200 1800 2400 4800
- 7200 9600 14400 19200 28800 38400 57600 76800 115200
- 230400 460800 921600
- } member? [ invalid-baud ] unless ;
-
-CONSTANT: TCSANOW 0
-CONSTANT: TCSADRAIN 1
-CONSTANT: TCSAFLUSH 2
-CONSTANT: TCSASOFT HEX: 10
-
-CONSTANT: TCIFLUSH 1
-CONSTANT: TCOFLUSH 2
-CONSTANT: TCIOFLUSH 3
-CONSTANT: TCOOFF 1
-CONSTANT: TCOON 2
-CONSTANT: TCIOFF 3
-CONSTANT: TCION 4
-
-! iflags
-CONSTANT: IGNBRK HEX: 00000001
-CONSTANT: BRKINT HEX: 00000002
-CONSTANT: IGNPAR HEX: 00000004
-CONSTANT: PARMRK HEX: 00000008
-CONSTANT: INPCK HEX: 00000010
-CONSTANT: ISTRIP HEX: 00000020
-CONSTANT: INLCR HEX: 00000040
-CONSTANT: IGNCR HEX: 00000080
-CONSTANT: ICRNL HEX: 00000100
-CONSTANT: IXON HEX: 00000200
-CONSTANT: IXOFF HEX: 00000400
-CONSTANT: IXANY HEX: 00000800
-CONSTANT: IMAXBEL HEX: 00002000
-CONSTANT: IUTF8 HEX: 00004000
-
-! oflags
-CONSTANT: OPOST HEX: 00000001
-CONSTANT: ONLCR HEX: 00000002
-CONSTANT: OXTABS HEX: 00000004
-CONSTANT: ONOEOT HEX: 00000008
-
-! cflags
-CONSTANT: CIGNORE HEX: 00000001
-CONSTANT: CSIZE HEX: 00000300
-CONSTANT: CS5 HEX: 00000000
-CONSTANT: CS6 HEX: 00000100
-CONSTANT: CS7 HEX: 00000200
-CONSTANT: CS8 HEX: 00000300
-CONSTANT: CSTOPB HEX: 00000400
-CONSTANT: CREAD HEX: 00000800
-CONSTANT: PARENB HEX: 00001000
-CONSTANT: PARODD HEX: 00002000
-CONSTANT: HUPCL HEX: 00004000
-CONSTANT: CLOCAL HEX: 00008000
-CONSTANT: CCTS_OFLOW HEX: 00010000
-CONSTANT: CRTS_IFLOW HEX: 00020000
-CONSTANT: CRTSCTS flags{ CCTS_OFLOW CRTS_IFLOW }
-CONSTANT: CDTR_IFLOW HEX: 00040000
-CONSTANT: CDSR_OFLOW HEX: 00080000
-CONSTANT: CCAR_OFLOW HEX: 00100000
-CONSTANT: MDMBUF HEX: 00100000
-
-! lflags
-CONSTANT: ECHOKE HEX: 00000001
-CONSTANT: ECHOE HEX: 00000002
-CONSTANT: ECHOK HEX: 00000004
-CONSTANT: ECHO HEX: 00000008
-CONSTANT: ECHONL HEX: 00000010
-CONSTANT: ECHOPRT HEX: 00000020
-CONSTANT: ECHOCTL HEX: 00000040
-CONSTANT: ISIG HEX: 00000080
-CONSTANT: ICANON HEX: 00000100
-CONSTANT: ALTWERASE HEX: 00000200
-CONSTANT: IEXTEN HEX: 00000400
-CONSTANT: EXTPROC HEX: 00000800
-CONSTANT: TOSTOP HEX: 00400000
-CONSTANT: FLUSHO HEX: 00800000
-CONSTANT: NOKERNINFO HEX: 02000000
-CONSTANT: PENDIN HEX: 20000000
-CONSTANT: NOFLSH HEX: 80000000
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax classes.struct kernel
-sequences system ;
-IN: io.serial.unix.termios
-
-CONSTANT: NCCS 20
-
-TYPEDEF: uint tcflag_t
-TYPEDEF: uchar cc_t
-TYPEDEF: uint speed_t
-
-STRUCT: termios
- { iflag tcflag_t }
- { oflag tcflag_t }
- { cflag tcflag_t }
- { lflag tcflag_t }
- { cc { cc_t NCCS } }
- { ispeed speed_t }
- { ospeed speed_t } ;
--- /dev/null
+! Copyright (C) 2008 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types alien.syntax classes.struct kernel
+sequences system ;
+IN: io.serial.unix.termios
+
+CONSTANT: NCCS 20
+
+TYPEDEF: uint tcflag_t
+TYPEDEF: uchar cc_t
+TYPEDEF: uint speed_t
+
+STRUCT: termios
+ { iflag tcflag_t }
+ { oflag tcflag_t }
+ { cflag tcflag_t }
+ { lflag tcflag_t }
+ { cc { cc_t NCCS } }
+ { ispeed speed_t }
+ { ospeed speed_t } ;
{
{ [ os linux? ] [ "io.serial.unix.termios.linux" ] }
- { [ os bsd? ] [ "io.serial.unix.termios.bsd" ] }
+ { [ os macosx? ] [ "io.serial.unix.termios.macosx" ] }
} cond require
math.bitwise tools.test ;
IN: io.serial.unix
-! "/dev/ttyS0" ! netbsd
-! "/dev/dty00" ! netbsd
-! "/dev/ttyd0" ! freebsd
-! "/dev/ttyU0" ! openbsd
-
: <serial-port-test> ( -- serial-port )
"/dev/ttyS0" 19200 <serial-port> ;
<< {
{ [ os linux? ] [ "io.serial.unix.linux" ] }
- { [ os bsd? ] [ "io.serial.unix.bsd" ] }
} cond require >>
FUNCTION: speed_t cfgetispeed ( termios* t ) ;
target-variant get [ "-" glue ] when* ;
: gnu-make ( -- string )
- target-os get { freebsd openbsd netbsd } member? "gmake" "make" ? ;
+ "make" ;
: boot-image-arch ( -- string )
target-os get target-cpu get arch ;
] with-scope
] unit-test
-[ { "scp" "boot.unix-x86.64.image" "joe@blah.com:/stuff/clean/netbsd-x86-64" } ] [
+[ { "scp" "boot.unix-x86.64.image" "joe@blah.com:/stuff/clean/windows-x86-64" } ] [
[
"scp" scp-command set
"joe" image-username set
"blah.com" image-host set
"/stuff/clean" image-directory set
- netbsd target-os set
+ windows target-os set
x86.64 target-cpu set
upload-clean-image-cmd
] with-scope
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: gnu-make ( -- string )
- os { freebsd openbsd netbsd } member? [ "gmake" ] [ "make" ] if ;
+ "make" ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+++ /dev/null
-include vm/Config.unix
-PLAF_DLL_OBJS += vm/os-genunix.o vm/os-freebsd.o vm/mvm-unix.o
-LIBS = -L/usr/local/lib/ -lm -lrt $(X11_UI_LIBS) -Wl,--export-dynamic
+++ /dev/null
-include vm/Config.freebsd
-include vm/Config.x86.32
+++ /dev/null
-include vm/Config.freebsd
-include vm/Config.x86.64
-LIBS += -lpthread
+++ /dev/null
-include vm/Config.macosx
-PLAF_DLL_OBJS += vm/cpu-ppc.macosx.o
-CFLAGS += -arch ppc -force_cpusubtype_ALL
+++ /dev/null
-include vm/Config.unix
-PLAF_DLL_OBJS += vm/os-genunix.o vm/os-netbsd.o vm/mvm-none.o
-LIBPATH = -L/usr/X11R7/lib -Wl,-rpath,/usr/X11R7/lib -L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib
-LIBS = -lm -lrt -lssl -lcrypto $(X11_UI_LIBS) -Wl,--export-dynamic
+++ /dev/null
-include vm/Config.netbsd
-include vm/Config.x86.32
+++ /dev/null
-include vm/Config.netbsd
-include vm/Config.x86.64
+++ /dev/null
-include vm/Config.unix
-PLAF_DLL_OBJS += vm/os-genunix.o vm/os-openbsd.o vm/mvm-unix.o
-CC = egcc
-CPP = eg++
-CFLAGS += -fno-inline-functions
-LIBS = -L/usr/local/lib/ -lm $(X11_UI_LIBS) -lz -lssl -lcrypto -lpthread -Wl,--export-dynamic
+++ /dev/null
-include vm/Config.openbsd
-include vm/Config.x86.32
+++ /dev/null
-include vm/Config.openbsd
-include vm/Config.x86.64
+++ /dev/null
-include vm/Config.unix
-PLAF_DLL_OBJS += vm/os-genunix.o vm/os-solaris.o
-CFLAGS += -D_STDC_C99 -Drestrict=""
-LIBS += -ldl -lsocket -lnsl -lm -lrt -R/opt/PM/lib -R/opt/csw/lib \
- -R/usr/local/lib -R/usr/sfw/lib -R/usr/X11R6/lib \
- -R/opt/sfw/lib $(X11_UI_LIBS) -Wl,--export-dynamic
+++ /dev/null
-include vm/Config.solaris
-include vm/Config.x86.32
+++ /dev/null
-include vm/Config.solaris
-include vm/Config.x86.64
p->datastack_size = 32 * sizeof(cell);
p->retainstack_size = 32 * sizeof(cell);
-#if defined(__OpenBSD__) && defined(FACTOR_X86)
- p->callstack_size = 64 * sizeof(cell);
-#elif defined(FACTOR_PPC)
+#if defined(FACTOR_PPC)
p->callstack_size = 256 * sizeof(cell);
#else
p->callstack_size = 128 * sizeof(cell);
#include "master.hpp"
-/* Multi-VM threading is not supported on NetBSD due to
-http://gnats.netbsd.org/25563 */
-
namespace factor
{
+++ /dev/null
-#include <ucontext.h>
-#include <machine/npx.h>
-
-namespace factor
-{
-
-inline static unsigned int uap_fpu_status(void *uap)
-{
- ucontext_t *ucontext = (ucontext_t *)uap;
- if (ucontext->uc_mcontext.mc_fpformat == _MC_FPFMT_387)
- {
- struct save87 *x87 = (struct save87 *)(&ucontext->uc_mcontext.mc_fpstate);
- return x87->sv_env.en_sw;
- }
- else if (ucontext->uc_mcontext.mc_fpformat == _MC_FPFMT_XMM)
- {
- struct savexmm *xmm = (struct savexmm *)(&ucontext->uc_mcontext.mc_fpstate);
- return xmm->sv_env.en_sw | xmm->sv_env.en_mxcsr;
- }
- else
- return 0;
-}
-
-inline static void uap_clear_fpu_status(void *uap)
-{
- ucontext_t *ucontext = (ucontext_t *)uap;
- if (ucontext->uc_mcontext.mc_fpformat == _MC_FPFMT_387)
- {
- struct save87 *x87 = (struct save87 *)(&ucontext->uc_mcontext.mc_fpstate);
- x87->sv_env.en_sw = 0;
- }
- else if (ucontext->uc_mcontext.mc_fpformat == _MC_FPFMT_XMM)
- {
- struct savexmm *xmm = (struct savexmm *)(&ucontext->uc_mcontext.mc_fpstate);
- xmm->sv_env.en_sw = 0;
- xmm->sv_env.en_mxcsr &= 0xffffffc0;
- }
-}
-
-
-#define UAP_STACK_POINTER(ucontext) (((ucontext_t *)ucontext)->uc_mcontext.mc_esp)
-#define UAP_PROGRAM_COUNTER(ucontext) (((ucontext_t *)ucontext)->uc_mcontext.mc_eip)
-
-}
+++ /dev/null
-#include <ucontext.h>
-#include <machine/fpu.h>
-
-namespace factor
-{
-
-inline static unsigned int uap_fpu_status(void *uap)
-{
- ucontext_t *ucontext = (ucontext_t *)uap;
- if (ucontext->uc_mcontext.mc_fpformat == _MC_FPFMT_XMM)
- {
- struct savefpu *xmm = (struct savefpu *)(&ucontext->uc_mcontext.mc_fpstate);
- return xmm->sv_env.en_sw | xmm->sv_env.en_mxcsr;
- }
- else
- return 0;
-}
-
-inline static void uap_clear_fpu_status(void *uap)
-{
- ucontext_t *ucontext = (ucontext_t *)uap;
- if (ucontext->uc_mcontext.mc_fpformat == _MC_FPFMT_XMM)
- {
- struct savefpu *xmm = (struct savefpu *)(&ucontext->uc_mcontext.mc_fpstate);
- xmm->sv_env.en_sw = 0;
- xmm->sv_env.en_mxcsr &= 0xffffffc0;
- }
-}
-
-
-#define UAP_STACK_POINTER(ucontext) (((ucontext_t *)ucontext)->uc_mcontext.mc_rsp)
-#define UAP_PROGRAM_COUNTER(ucontext) (((ucontext_t *)ucontext)->uc_mcontext.mc_rip)
-
-}
+++ /dev/null
-#include "master.hpp"
-
-namespace factor
-{
-
-/* From SBCL */
-const char *vm_executable_path()
-{
- char path[PATH_MAX + 1];
-
- if (getosreldate() >= 600024)
- {
- /* KERN_PROC_PATHNAME is available */
- size_t len = PATH_MAX + 1;
- int mib[4];
-
- mib[0] = CTL_KERN;
- mib[1] = KERN_PROC;
- mib[2] = KERN_PROC_PATHNAME;
- mib[3] = -1;
- if (sysctl(mib, 4, &path, &len, NULL, 0) != 0)
- return NULL;
- }
- else
- {
- int size;
- size = readlink("/proc/curproc/file", path, sizeof(path) - 1);
- if (size < 0)
- return NULL;
- path[size] = '\0';
- }
-
- if(strcmp(path, "unknown") == 0)
- return NULL;
-
- return safe_strdup(path);
-}
-
-}
+++ /dev/null
-#include <osreldate.h>
-#include <sys/sysctl.h>
-
-extern "C" int getosreldate();
-
-#ifndef KERN_PROC_PATHNAME
-#define KERN_PROC_PATHNAME 12
-#endif
-
-#define UAP_STACK_POINTER_TYPE __register_t
-
-#define CODE_TO_FUNCTION_POINTER(code) (void)0
-#define CODE_TO_FUNCTION_POINTER_CALLBACK(vm, code) (void)0
-#define FUNCTION_CODE_POINTER(ptr) ptr
-#define FUNCTION_TOC_POINTER(ptr) ptr
-#define UAP_SET_TOC_POINTER(uap, ptr) (void)0
+++ /dev/null
-#include <ucontext.h>
-
-namespace factor
-{
-
-static inline unsigned int uap_fpu_status(void *uap) { return 0; }
-static inline void uap_clear_fpu_status(void *uap) {}
-
-#define UAP_STACK_POINTER(ucontext) (_UC_MACHINE_SP((ucontext_t *)ucontext))
-
-}
+++ /dev/null
-#include <ucontext.h>
-
-namespace factor
-{
-
-static inline unsigned int uap_fpu_status(void *uap) { return 0; }
-static inline void uap_clear_fpu_status(void *uap) {}
-
-#define UAP_STACK_POINTER(ucontext) (((ucontext_t *)ucontext)->uc_mcontext.__gregs[_REG_URSP])
-
-}
+++ /dev/null
-#include "master.hpp"
-
-namespace factor
-{
-
-extern "C" int main();
-
-const char *vm_executable_path()
-{
- static Dl_info info = {0};
- if (!info.dli_fname)
- dladdr((void *)main, &info);
- return safe_strdup(info.dli_fname);
-}
-
-}
+++ /dev/null
-#include <ucontext.h>
-
-#define UAP_PROGRAM_COUNTER(uap) _UC_MACHINE_PC((ucontext_t *)uap)
-
-#define UAP_STACK_POINTER_TYPE __greg_t
-
-#define UAP_SET_TOC_POINTER(uap, ptr) (void)0
-#define CODE_TO_FUNCTION_POINTER(code) (void)0
-#define CODE_TO_FUNCTION_POINTER_CALLBACK(vm, code) (void)0
-#define FUNCTION_CODE_POINTER(ptr) ptr
-#define FUNCTION_TOC_POINTER(ptr) ptr
+++ /dev/null
-#include <i386/signal.h>
-
-namespace factor
-{
-
-static inline unsigned int uap_fpu_status(void *uap) { return 0; }
-static inline void uap_clear_fpu_status(void *uap) {}
-
-#define UAP_STACK_POINTER(ucontext) (((struct sigcontext *)ucontext)->sc_esp)
-#define UAP_PROGRAM_COUNTER(ucontext) (((struct sigcontext *)ucontext)->sc_eip)
-
-}
+++ /dev/null
-#include <amd64/signal.h>
-
-namespace factor
-{
-
-static inline unsigned int uap_fpu_status(void *uap) { return 0; }
-static inline void uap_clear_fpu_status(void *uap) {}
-
-#define UAP_STACK_POINTER(ucontext) (((struct sigcontext *)ucontext)->sc_rsp)
-#define UAP_PROGRAM_COUNTER(ucontext) (((struct sigcontext *)ucontext)->sc_rip)
-
-}
+++ /dev/null
-#include "master.hpp"
-
-namespace factor
-{
-
-const char *vm_executable_path()
-{
- return NULL;
-}
-
-}
+++ /dev/null
-#define UAP_STACK_POINTER_TYPE __register_t
-
-#define UAP_SET_TOC_POINTER(uap, ptr) (void)0
-#define CODE_TO_FUNCTION_POINTER(code) (void)0
-#define CODE_TO_FUNCTION_POINTER_CALLBACK(vm, code) (void)0
-#define FUNCTION_CODE_POINTER(ptr) ptr
-#define FUNCTION_TOC_POINTER(ptr) ptr
+++ /dev/null
-#include <ucontext.h>
-
-namespace factor
-{
-
-#define UAP_STACK_POINTER(ucontext) (((ucontext_t *)ucontext)->uc_mcontext.gregs[ESP])
-#define UAP_PROGRAM_COUNTER(ucontext) (((ucontext_t *)ucontext)->uc_mcontext.gregs[EIP])
-
-#define UAP_SET_TOC_POINTER(uap, ptr) (void)0
-#define CODE_TO_FUNCTION_POINTER(code) (void)0
-#define CODE_TO_FUNCTION_POINTER_CALLBACK(vm, code) (void)0
-#define FUNCTION_CODE_POINTER(ptr) ptr
-#define FUNCTION_TOC_POINTER(ptr) ptr
-}
+++ /dev/null
-#include <ucontext.h>
-
-namespace factor
-{
-
-#define UAP_STACK_POINTER(ucontext) (((ucontext_t *)ucontext)->uc_mcontext.gregs[RSP])
-#define UAP_PROGRAM_COUNTER(ucontext) (((ucontext_t *)ucontext)->uc_mcontext.gregs[RIP])
-
-#define UAP_SET_TOC_POINTER(uap, ptr) (void)0
-#define CODE_TO_FUNCTION_POINTER(code) (void)0
-#define CODE_TO_FUNCTION_POINTER_CALLBACK(vm, code) (void)0
-#define FUNCTION_CODE_POINTER(ptr) ptr
-#define FUNCTION_TOC_POINTER(ptr) ptr
-}
+++ /dev/null
-#include "master.hpp"
-
-namespace factor
-{
-
-const char *vm_executable_path()
-{
- return NULL;
-}
-
-}
#else
#include "os-genunix.hpp"
- #ifdef __FreeBSD__
- #define FACTOR_OS_STRING "freebsd"
- #include "os-freebsd.hpp"
-
- #if defined(FACTOR_X86)
- #include "os-freebsd-x86.32.hpp"
- #elif defined(FACTOR_AMD64)
- #include "os-freebsd-x86.64.hpp"
- #else
- #error "Unsupported FreeBSD flavor"
- #endif
- #elif defined(__OpenBSD__)
- #define FACTOR_OS_STRING "openbsd"
- #include "os-openbsd.hpp"
-
- #if defined(FACTOR_X86)
- #include "os-openbsd-x86.32.hpp"
- #elif defined(FACTOR_AMD64)
- #include "os-openbsd-x86.64.hpp"
- #else
- #error "Unsupported OpenBSD flavor"
- #endif
- #elif defined(__NetBSD__)
- #define FACTOR_OS_STRING "netbsd"
- #include "os-netbsd.hpp"
-
- #if defined(FACTOR_X86)
- #include "os-netbsd-x86.32.hpp"
- #elif defined(FACTOR_AMD64)
- #include "os-netbsd-x86.64.hpp"
- #else
- #error "Unsupported NetBSD flavor"
- #endif
-
- #elif defined(linux)
+ #if defined(linux)
#define FACTOR_OS_STRING "linux"
#include "os-linux.hpp"
#else
#error "Unsupported Linux flavor"
#endif
- #elif defined(__SVR4) && defined(sun)
- #define FACTOR_OS_STRING "solaris"
-
- #if defined(FACTOR_X86)
- #include "os-solaris-x86.32.hpp"
- #elif defined(FACTOR_AMD64)
- #include "os-solaris-x86.64.hpp"
- #else
- #error "Unsupported Solaris flavor"
- #endif
-
#else
#error "Unsupported OS"
#endif