-USING: accessors alien.libraries kernel sequences system vocabs
-;
+USING: accessors alien.libraries kernel lexer parser sequences
+system vocabs vocabs.platforms ;
IN: alien.libraries.finder
HOOK: find-library* os ( name -- path/f )
dup [ find-library* ] map-find drop
[ ] [ ?first "library_not_found" or ] ?if ;
-"alien.libraries.finder." os name>> append require
+SYNTAX: ADD-FIRST-LIBRARY:
+ scan-token scan-word scan-object
+ find-library-from-list swap add-library ;
+
+USE-OS-SUFFIX: alien.libraries.finder
! Copyright (C) 2009, 2010 Slava Pestov, Joe Groff.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien alien.strings assocs combinators
-compiler.errors destructors kernel namespaces sequences strings
-system vocabs ;
+compiler.errors destructors kernel lexer namespaces
+parser sequences strings system vocabs vocabs.platforms ;
IN: alien.libraries
PRIMITIVE: dll-valid? ( dll -- ? )
[ deploy-libraries get 2dup member? [ 2drop ] [ push ] if ]
[ "deploy-library failure" no-such-library ] if ;
+SYNTAX: DEPLOY-LIBRARY: scan-token deploy-library ;
+
HOOK: >deployed-library-path os ( path -- path' )
-{
- { [ os windows? ] [ "alien.libraries.windows" ] }
- { [ os unix? ] [ "alien.libraries.unix" ] }
-} cond require
+SYNTAX: LIBRARY-MACOSX: scan-token scan-object scan-object swap add-library ;
+SYNTAX: LIBRARY-UNIX: scan-token scan-object scan-object swap add-library ;
+SYNTAX: LIBRARY-WINDOWS: scan-token scan-object scan-object swap add-library ;
+
+USE-UNIX: alien.libraries.unix
+USE-WINDOWS: alien.libraries.windows
! Copyright (C) 2010 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.libraries alien.syntax combinators
-gobject-introspection system vocabs ;
+gobject-introspection system vocabs vocabs.platforms ;
IN: atk.ffi
<< "gobject.ffi" require >>
LIBRARY: atk
-<< "atk" {
- { [ os windows? ] [ "libatk-1.0-0.dll" ] }
- { [ os macosx? ] [ "libatk-1.0.dylib" ] }
- { [ os unix? ] [ "libatk-1.0.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: atk cdecl "libatk-1.0.so"
+LIBRARY-MACOSX: atk cdecl "libatk-1.0.dylib"
+LIBRARY-WINDOWS: atk cdecl "libatk-1.0-0.dll"
GIR: vocab:atk/Atk-1.0.gir
INSTANCE: bit-array sequence
-{ "bit-arrays" "prettyprint" } "bit-arrays.prettyprint" require-when
+USE-WHEN-LOADED: bit-arrays.prettyprint { "bit-arrays" "prettyprint" }
M: bit-vector contract 2drop ;
-{ "bit-vectors" "prettyprint" } "bit-vectors.prettyprint" require-when
+USE-WHEN-LOADED: bit-vectors.prettyprint { "bit-vectors" "prettyprint" }
] unless
{ "boostrap.compiler" "prettyprint" } "alien.prettyprint" require-when
+! USE-WHEN-LOADED: alien.prettyprint { "boostrap.compiler" "prettyprint" }
"cpu." cpu name>> append require
USING: vocabs.loader vocabs kernel ;
IN: bootstrap.handbook
-{ "bootstrap.handbook" "bootstrap.help" } "help.handbook" require-when
+USE-WHEN-LOADED: help.handbook { "bootstrap.handbook" "bootstrap.help" }
"ui.tools" require
-{ "ui.backend.cocoa" } "ui.backend.cocoa.tools" require-when
+USE-WHEN-LOADED: ui.backend.cocoa.tools { "ui.backend.cocoa" }
"ui.tools.walker" require
! Adapted from cairo.h, version 1.8.10
-<< "cairo" {
- { [ os windows? ] [ "libcairo-2.dll" ] }
- { [ os macosx? ] [ "libcairo.dylib" ] }
- { [ os unix? ] [ "libcairo.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: cairo cdecl "libcairo.so"
+LIBRARY-MACOSX: cairo cdecl "libcairo.dylib"
+LIBRARY-WINDOWS: cairo cdecl "libcairo-2.dll"
LIBRARY: cairo
USING: accessors arrays classes.tuple combinators
combinators.short-circuit kernel literals math math.functions
math.intervals math.order math.statistics sequences slots.syntax
-system vocabs vocabs.loader ;
+system vocabs vocabs.loader vocabs.platforms ;
FROM: ranges => [a..b) ;
IN: calendar
M: timestamp weeks-in-week-year
{ [ january 1 >>day thursday? ] [ december 31 >>day thursday? ] } 1|| 53 52 ? ;
-{
- { [ os unix? ] [ "calendar.unix" ] }
- { [ os windows? ] [ "calendar.windows" ] }
-} cond require
+USE-UNIX: calendar.unix
+USE-WINDOWS: calendar.windows
-{ "threads" "calendar" } "calendar.threads" require-when
+USE-WHEN-LOADED: calendar.threads { "threads" "calendar" }
[ parse-struct-slots* ] [ ] while
[ >array define-struct-class ] append! ;
-{ "classes.struct" "prettyprint" } "classes.struct.prettyprint" require-when
+USE-WHEN-LOADED: classes.struct.prettyprint { "classes.struct" "prettyprint" }
SYNTAX: COLOR: scan-token dup parse-color parsed-color boa suffix! ;
-{ "colors" "prettyprint" } "colors.prettyprint" require-when
+USE-WHEN-LOADED: colors.prettyprint { "colors" "prettyprint" }
default-cli-args
]
-{ "debugger" "command-line" } "command-line.debugger" require-when
+USE-WHEN-LOADED: command-line.debugger { "debugger" "command-line" }
: disable-optimizer ( -- )
f compiler-impl set-global ;
-{ "prettyprint" "compiler" } "compiler.prettyprint" require-when
-{ "threads" "compiler" } "compiler.threads" require-when
+USE-WHEN-LOADED: compiler.prettyprint { "prettyprint" "compiler" }
+USE-WHEN-LOADED: compiler.threads { "threads" "compiler" }
combinators system ;
IN: compression.snappy.ffi
-<< "snappy" {
- { [ os windows? ] [ "snappy.dll" ] }
- { [ os macosx? ] [ "libsnappy.dylib" ] }
- { [ os unix? ] [ "libsnappy.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: snappy cdecl "libsnappy.so"
+LIBRARY-MACOSX: snappy cdecl "libsnappy.dylib"
+LIBRARY-WINDOWS: snappy cdecl "snappy.dll"
LIBRARY: snappy
classes.struct combinators system ;
IN: compression.zlib.ffi
-<< "zlib" {
- { [ os windows? ] [ "zlib1.dll" ] }
- { [ os macosx? ] [ "libz.dylib" ] }
- { [ os unix? ] [ "libz.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: zlib cdecl "libz.so"
+LIBRARY-MACOSX: zlib cdecl "libz.dylib"
+LIBRARY-WINDOWS: zlib cdecl "zlib1.dll"
LIBRARY: zlib
combinators system ;
IN: compression.zstd.ffi
-<< "zstd" {
- { [ os windows? ] [ "libzstd.dll" ] }
- { [ os macosx? ] [ "libzstd.dylib" ] }
- { [ os unix? ] [ "libzstd.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: zstd cdecl "libzstd.so"
+LIBRARY-MACOSX: zstd cdecl "libzstd.dylib"
+LIBRARY-WINDOWS: zstd cdecl "libzstd.dll"
LIBRARY: zstd
: spawn-linked-to ( quot name mailbox -- thread )
<linked-thread> [ (spawn) ] keep ;
-{ "concurrency.mailboxes" "debugger" } "concurrency.mailboxes.debugger" require-when
+USE-WHEN-LOADED: concurrency.mailboxes.debugger { "concurrency.mailboxes" "debugger" }
compiler.codegen.gc-maps compiler.codegen.labels
compiler.codegen.relocation compiler.constants cpu.architecture
cpu.x86 cpu.x86.assembler cpu.x86.assembler.operands cpu.x86.features
-kernel locals math sequences specialized-arrays system vocabs ;
+kernel locals math sequences specialized-arrays system vocabs
+vocabs.platforms ;
SPECIALIZED-ARRAY: uint
IN: cpu.x86.64
RSI 12 [+] EDX MOV
] alien-assembly ;
-{
- { [ os unix? ] [ "cpu.x86.64.unix" require ] }
- { [ os windows? ] [ "cpu.x86.64.windows" require ] }
-} cond
+USE-UNIX: cpu.x86.64.unix
+USE-WINDOWS: cpu.x86.64.windows
combinators system ;
IN: db.postgresql.ffi
-<< "postgresql" {
- { [ os windows? ] [ "libpq.dll" ] }
- { [ os macosx? ] [ "libpq.dylib" ] }
- { [ os unix? ] [ "libpq.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: postgresql cdecl "libpq.so"
+LIBRARY-MACOSX: postgresql cdecl "libpq.dylib"
+LIBRARY-WINDOWS: postgresql cdecl "libpq.dll"
! ConnSatusType
CONSTANT: CONNECTION_OK 0x0
combinators system ;
IN: db.sqlite.ffi
-<< "sqlite" {
- { [ os windows? ] [ "sqlite3.dll" ] }
- { [ os macosx? ] [ "libsqlite3.dylib" ] }
- { [ os unix? ] [ "libsqlite3.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: sqlite cdecl "libsqlite3.so"
+LIBRARY-MACOSX: sqlite cdecl "libsqlite3.dylib"
+LIBRARY-WINDOWS: sqlite cdecl "sqlite3.dll"
! Return values from sqlite functions
CONSTANT: SQLITE_OK 0 ! Successful result
math math.order math.parser math.ratios namespaces parser
prettyprint sequences sequences.private slots
source-files.errors strings strings.parser summary system vocabs
-vocabs.loader vocabs.parser words ;
+vocabs.loader vocabs.parser vocabs.platforms words ;
IN: debugger
GENERIC: error-help ( error -- topic )
M: callsite-not-compiled summary
drop "Caller not compiled with the optimizing compiler" ;
-{ "threads" "debugger" } "debugger.threads" require-when
+USE-UNIX: debugger.unix
-os unix? [ "debugger.unix" require ] when
+USE-WHEN-LOADED: debugger.threads { "threads" "debugger" }
SYNTAX: DL{ \ } [ >dlist ] parse-literal ;
-{ "dlists" "prettyprint" } "dlists.prettyprint" require-when
+USE-WHEN-LOADED: dlists.prettyprint { "dlists" "prettyprint" }
io.encodings.utf8 io.sockets io.sockets.private
io.streams.byte-array io.timeouts kernel make math math.bitwise
math.parser namespaces random sequences slots.syntax splitting
-system vectors vocabs ;
+system vectors vocabs vocabs.platforms ;
IN: dns
: with-input-seek ( n seek-type quot -- )
HOOK: initial-dns-servers os ( -- sequence )
-{
- { [ os windows? ] [ "dns.windows" ] }
- { [ os unix? ] [ "dns.unix" ] }
-} cond require
+USE-UNIX: dns.unix
+USE-WINDOWS: dns.windows
: with-dns-servers ( servers quot -- )
[ dns-servers ] dip with-variable ; inline
! Copyright (C) 2015 Dimage Sapelkin.
! See http://factorcode.org/license.txt for BSD license.
USING: editors io.pathnames io.standard-paths kernel make
-namespaces system vocabs ;
+namespaces system vocabs vocabs.platforms ;
IN: editors.brackets
SINGLETON: brackets
M: brackets editor-command
[ brackets-path "brackets" or , drop , ] { } make ;
-os windows? [ "editors.brackets.windows" require ] when
+USE-WINDOWS: editors.brackets.windows
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: assocs combinators continuations init kernel sequences
-splitting system vocabs vocabs.loader ;
+splitting system vocabs vocabs.loader vocabs.platforms ;
IN: environment
HOOK: os-env os ( key -- value )
over [ [ [ set-os-env ] 2curry ] [ compose ] bi* ] dip
[ os-env ] keep [ set-os-env ] 2curry finally ; inline
-{
- { [ os unix? ] [ "environment.unix" require ] }
- { [ os windows? ] [ "environment.windows" require ] }
-} cond
+USE-UNIX: environment.unix
+USE-WINDOWS: environment.windows
STARTUP-HOOK: [
"FACTOR_ROOTS" os-env [
! See http://factorcode.org/license.txt for BSD license.
USING: alien.accessors alien.c-types alien.data alien.strings
alien.syntax alien.utilities environment io.encodings.utf8
-kernel libc system unix.ffi vocabs ;
+kernel libc system unix.ffi vocabs vocabs.platforms ;
IN: environment.unix
HOOK: environ os ( -- void* )
M: unix (set-os-envs)
utf8 strings>alien malloc-byte-array set-os-envs-pointer ;
-os macosx? [ "environment.unix.macosx" require ] when
+USE-MACOSX: environment.unix.macosx
\ No newline at end of file
! Copyright (C) 2021 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs continuations kernel sequences
-vocabs vocabs.parser ;
+USING: accessors assocs continuations kernel sequences vocabs
+vocabs.parser words ;
IN: fixups
CONSTANT: vocab-renames {
M: f compute-fixups 2drop { } ;
+M: undefined-word compute-fixups
+ 2drop { } ;
+
M: no-vocab compute-fixups
[ name>> vocab-renames compute-assoc-fixups ] [ drop { } ] if* ;
: buttons-delta ( old-buttons new-buttons -- delta )
{ } buttons-delta-as ; inline
-{
- { [ os windows? ] [ "game.input.dinput" require ] }
- { [ os macosx? ] [ "game.input.iokit" require ] }
- { [ os linux? ] [ "game.input.gtk" require ] }
- [ ]
-} cond
+USE-WINDOWS: game.input.dinput
+USE-MACOSX: game.input.iokit
+USE-LINUX: game.input.gtk
\ No newline at end of file
LIBRARY: gdk
-<<
-"gdk" {
- { [ os windows? ] [ "libgdk-win32-2.0-0.dll" cdecl add-library ] }
- { [ os macosx? ] [ drop ] }
- { [ os unix? ] [ "libgdk-x11-2.0.so" cdecl add-library ] }
-} cond
->>
+LIBRARY-UNIX: gdk cdecl "libgdk-x11-2.0.so"
+LIBRARY-WINDOWS: gdk cdecl "libgdk-win32-2.0-0.dll"
! <workaround these types are from cairo 1.10
STRUCT: cairo_rectangle_int_t
LIBRARY: gdk.gl
-<<
-"gdk.gl" {
- { [ os windows? ] [ "libgdkglext-win32-1.0-0.dll" cdecl add-library ] }
- { [ os macosx? ] [ drop ] }
- { [ os unix? ] [ "libgdkglext-x11-1.0.so" cdecl add-library ] }
-} cond
->>
+LIBRARY-UNIX: gdk.gl cdecl "libgdkglext-x11-1.0.so"
+LIBRARY-WINDOWS: gdk.gl cdecl "libgdkglext-win32-1.0-0.dll"
GIR: vocab:gdk/gl/GdkGLExt-1.0.gir
LIBRARY: gdk.pixbuf
-<< "gdk.pixbuf" {
- { [ os windows? ] [ "libgdk_pixbuf-2.0-0.dll" ] }
- { [ os macosx? ] [ "libgdk_pixbuf-2.0.dylib" ] }
- { [ os unix? ] [ "libgdk_pixbuf-2.0.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: gdk.pixbuf cdecl "libgdk_pixbuf-2.0.so"
+LIBRARY-MACOSX: gdk.pixbuf cdecl "libgdk_pixbuf-2.0.dylib"
+LIBRARY-WINDOWS: gdk.pixbuf cdecl "libgdk_pixbuf-2.0-0.dll"
GIR: vocab:gdk/pixbuf/GdkPixbuf-2.0.gir
LIBRARY: gio
-<< "gio" {
- { [ os windows? ] [ "libgio-2.0-0.dll" ] }
- { [ os macosx? ] [ "libgio-2.0.dylib" ] }
- { [ os unix? ] [ "libgio-2.0.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: gio cdecl "libgio-2.0.so"
+LIBRARY-MACOSX: gio cdecl "libgio-2.0.dylib"
+LIBRARY-WINDOWS: gio cdecl "libgio-2.0-0.dll"
GIR: vocab:gio/Gio-2.0.gir
LIBRARY: glib
-<< "glib" {
- { [ os windows? ] [ "libglib-2.0-0.dll" ] }
- { [ os macosx? ] [ "libglib-2.0.dylib" ] }
- { [ os unix? ] [ "libglib-2.0.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: glib cdecl "libglib-2.0.so"
+LIBRARY-MACOSX: glib cdecl "libglib-2.0.dylib"
+LIBRARY-WINDOWS: glib cdecl "libglib-2.0-0.dll"
IMPLEMENT-STRUCTS: GError GPollFD GSource GSourceFuncs ;
LIBRARY: gmodule
-<< "gmodule" {
- { [ os windows? ] [ "libgmodule-2.0-0.dll" ] }
- { [ os macosx? ] [ "libgmodule-2.0.dylib" ] }
- { [ os unix? ] [ "libgmodule-2.0.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: gmodule cdecl "libgmodule-2.0.so"
+LIBRARY-MACOSX: gmodule cdecl "libgmodule-2.0.dylib"
+LIBRARY-WINDOWS: gmodule cdecl "libgmodule-2.0-0.dll"
GIR: vocab:gmodule/GModule-2.0.gir
LIBRARY: gobject
-<< "gobject" {
- { [ os windows? ] [ "libgobject-2.0-0.dll" ] }
- { [ os macosx? ] [ "libgobject-2.0.dylib" ] }
- { [ os unix? ] [ "libgobject-2.0.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: gobject cdecl "libgobject-2.0.so"
+LIBRARY-MACOSX: gobject cdecl "libgobject-2.0.dylib"
+LIBRARY-WINDOWS: gobject cdecl "libgobject-2.0-0.dll"
IMPLEMENT-STRUCTS: GValue GParamSpecVariant ;
! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types alien.destructors alien.libraries
alien.syntax combinators gobject-introspection
-gobject-introspection.standard-types kernel pango.ffi system vocabs ;
+gobject-introspection.standard-types kernel pango.ffi system
+vocabs ;
IN: gtk.ffi
<<
LIBRARY: gtk
-<<
-"gtk" {
- { [ os windows? ] [ "libgtk-win32-2.0-0.dll" cdecl add-library ] }
- { [ os linux? ] [ "libgtk-x11-2.0.so" cdecl add-library ] }
- [ drop ]
-} cond
->>
+USE-WINDOWS: gtk cdecl "libgtk-win32-2.0-0.dll"
+USE-LINUX: gtk cdecl "libgtk-x11-2.0.so"
IMPLEMENT-STRUCTS: GtkTreeIter ;
! Copyright (C) 2010 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.libraries alien.syntax combinators
-gobject-introspection kernel system vocabs ;
+gobject-introspection kernel system vocabs vocabs.platforms ;
IN: gtk.gl.ffi
<<
LIBRARY: gtk.gl
-<<
-"gtk.gl" {
- { [ os windows? ] [ drop ] }
- { [ os macosx? ] [ drop ] }
- { [ os unix? ] [ "libgtkglext-x11-1.0.so" cdecl add-library ] }
-} cond
->>
+USE-UNIX: gtk.gl cdecl "libgtkglext-x11-1.0.so"
GIR: vocab:gtk/gl/GtkGLExt-1.0.gir
SYNTAX: IHS{ \ } [ >identity-hash-set ] parse-literal ;
-{ "hash-sets.identity" "prettyprint" } "hash-sets.identity.prettyprint" require-when
+USE-WHEN-LOADED: hash-sets.identity.prettyprint { "hash-sets.identity" "prettyprint" }
SYNTAX: NHS{ \ } [ >number-hash-set ] parse-literal ;
-{ "hash-sets.numbers" "prettyprint" } "hash-sets.numbers.prettyprint" require-when
+USE-WHEN-LOADED: hash-sets.numbers.prettyprint { "hash-sets.numbers" "prettyprint" }
SYNTAX: SHS{ \ } [ >sequence-hash-set ] parse-literal ;
-{ "hash-sets.sequences" "prettyprint" } "hash-sets.sequences.prettyprint" require-when
+USE-WHEN-LOADED: hash-sets.sequences.prettyprint { "hash-sets.sequences" "prettyprint" }
+
INSTANCE: wrapped-hash-set set
-{ "hash-sets.wrapped" "prettyprint" } "hash-sets.wrapped.prettyprint" require-when
+USE-WHEN-LOADED: hash-sets.wrapped.prettyprint { "hash-sets.wrapped" "prettyprint" }
SYNTAX: NH{ \ } [ >number-hashtable ] parse-literal ;
-{ "hashtables.numbers" "prettyprint" } "hashtables.numbers.prettyprint" require-when
+USE-WHEN-LOADED: hashtables.numbers.prettyprint { "hashtables.numbers" "prettyprint" }
SYNTAX: SH{ \ } [ >sequence-hashtable ] parse-literal ;
-{ "hashtables.sequences" "prettyprint" } "hashtables.sequences.prettyprint" require-when
+USE-WHEN-LOADED: hashtables.sequences.prettyprint { "hashtables.sequences" "prettyprint" }
: http-trace* ( url -- response data )
<trace-request> http-request* ;
-{ "http.client" "debugger" } "http.client.debugger" require-when
+USE-WHEN-LOADED: http.client.debugger { "http.client" "debugger" }
-USING: io.backend io.backend.unix system namespaces kernel accessors assocs continuations unix init io.backend.unix.multiplexers io.backend.unix.multiplexers.kqueue vocabs io.files.unix ;
+USING: io.backend io.backend.unix system namespaces kernel
+accessors assocs continuations unix init io.backend.unix.multiplexers
+io.backend.unix.multiplexers.kqueue vocabs io.files.unix ;
<< "io.files.unix" require >> ! needed for deploy
dlists fry io io.backend io.encodings.binary io.files
io.files.info io.files.links io.files.types io.pathnames kernel
kernel.private make math namespaces sequences sorting strings
-system unicode vocabs ;
+system unicode vocabs vocabs.platforms ;
IN: io.directories
: set-current-directory ( path -- )
: copy-trees-into ( files to -- )
'[ _ copy-tree-into ] each ;
-{
- { [ os unix? ] [ "io.directories.unix" require ] }
- { [ os windows? ] [ "io.directories.windows" require ] }
-} cond
+USE-UNIX: io.directories.unix
+USE-WINDOWS: io.directories.windows
\ No newline at end of file
classes.struct continuations fry io.backend io.backend.unix
io.directories io.files io.files.info io.files.info.unix
io.files.types kernel libc literals math sequences system unix
-unix.ffi vocabs ;
+unix.ffi vocabs vocabs.platforms ;
IN: io.directories.unix
CONSTANT: touch-mode flags{ O_WRONLY O_APPEND O_CREAT O_EXCL }
'[ _ _ next-dirent ] [ >directory-entry ] produce nip
] with-unix-directory ;
-os linux? [ "io.directories.unix.linux" require ] when
+USE-LINUX: io.directories.unix.linux
\ No newline at end of file
! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs combinators combinators.short-circuit
io.files io.files.types io.pathnames kernel math strings system
-vocabs ;
+vocabs vocabs.platforms ;
IN: io.files.info
! File info
: find-mount-point ( path -- object )
mount-points (find-mount-point) ;
-{
- { [ os unix? ] [ "io.files.info.unix" ] }
- { [ os windows? ] [ "io.files.info.windows" ] }
-} cond require
+USE-UNIX: io.files.info.unix
+USE-WINDOWS: io.fiels.info.windows
classes.struct combinators combinators.short-circuit io.backend
io.files.info io.files.types kernel libc math math.bitwise
sequences specialized-arrays strings system unix unix.ffi
-unix.groups unix.stat unix.time unix.users vocabs ;
+unix.groups unix.stat unix.time unix.users vocabs vocabs.platforms ;
IN: io.files.info.unix
SPECIALIZED-ARRAY: timeval
M: unix file-writable? W_OK access? ;
M: unix file-executable? X_OK access? ;
-"io.files.info.unix." os name>> append require
+USE-OS-SUFFIX: io.files.info.unix
! Copyright (C) 2008 Slava Pestov, Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors io.backend io.files.info io.files.types
-io.pathnames kernel math namespaces system vocabs ;
+io.pathnames kernel math namespaces system vocabs vocabs.platforms ;
IN: io.files.links
HOOK: make-link os ( target symlink -- )
: copy-link ( target symlink -- )
[ read-link ] dip make-link ;
-os unix? [ "io.files.links.unix" require ] when
-
: follow-link ( path -- path' )
[ parent-directory ] [ read-link ] bi append-path ;
: follow-links ( path -- path' )
[ symlink-depth get ] dip normalize-path (follow-links) ;
+
+USE-UNIX: io.files.links.unix
! Copyright (C) 2012 Joe Groff.
! See http://factorcode.org/license.txt for BSD license.
USING: combinators init io.directories io.pathnames kernel
-namespaces system vocabs ;
+namespaces system vocabs vocabs.platforms ;
IN: io.files.temp
HOOK: default-temp-directory os ( -- path )
: with-cache-directory ( quot -- )
[ cache-directory ] dip with-directory ; inline
-{
- { [ os windows? ] [ "io.files.temp.windows" ] }
- { [ os macosx? ] [ "io.files.temp.macosx" ] }
- { [ os unix? ] [ "io.files.temp.unix" ] }
-} cond require
+USE-MACOSX: io.files.temp.macosx
+USE-UNIX: io.files.temp.unix
+USE-WINDOWS: io.files.temp.windows
STARTUP-HOOK: [
default-temp-directory dup make-directories
! See http://factorcode.org/license.txt for BSD license.
USING: combinators continuations fry io.backend io.directories
io.pathnames kernel locals namespaces random.data sequences
-system vocabs ;
+system vocabs vocabs.platforms ;
IN: io.files.unique
<PRIVATE
[ path quot with-directory ]
[ path delete-tree ] finally ; inline
-{
- { [ os unix? ] [ "io.files.unique.unix" ] }
- { [ os windows? ] [ "io.files.unique.windows" ] }
-} cond require
+USE-UNIX: io.files.unique.unix
+USE-WINDOWS: io.files.unique.windows
debugger destructors environment fry init io io.backend
io.encodings io.encodings.utf8 io.pipes io.pipes.private
io.ports io.streams.duplex io.timeouts kernel math math.order
-namespaces prettyprint sequences strings system threads vocabs ;
+namespaces prettyprint sequences strings system threads vocabs
+vocabs.platforms ;
IN: io.launcher
[ [ stream-contents ] [ dup (wait-for-process) ] bi* ] with-timeout
0 = [ 2drop ] [ output-process-error ] if ;
-{
- { [ os unix? ] [ "io.launcher.unix" require ] }
- { [ os windows? ] [ "io.launcher.windows" require ] }
-} cond
+USE-UNIX: io.launcher.unix
+USE-WINDOWS: io.launcher.windows
! Copyright (C) 2007, 2009 Doug Coleman, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types alien.data combinators
-destructors io.backend io.files.info kernel math system vocabs ;
+destructors io.backend io.files.info kernel math system vocabs
+vocabs.platforms ;
IN: io.mmap
TUPLE: mapped-file < disposable address handle length ;
: with-mapped-array-reader ( path c-type quot -- )
[ <mapped-file-reader> ] 2dip (with-mapped-array) ; inline
-{
- { [ os unix? ] [ "io.mmap.unix" require ] }
- { [ os windows? ] [ "io.mmap.windows" require ] }
-} cond
+USE-UNIX: io.mmap.unix
+USE-WINDOWS: io.mmap.windows
! See http://factorcode.org/license.txt for BSD license.
USING: accessors concurrency.mailboxes continuations destructors
fry io.backend io.timeouts kernel namespaces sequences system
-vocabs ;
+vocabs vocabs.platforms ;
IN: io.monitors
HOOK: init-monitors io-backend ( -- )
: run-monitor ( path recursive? quot -- )
'[ [ @ t ] loop ] with-monitor ; inline
-"io.monitors." os name>> append require
+USE-OS-SUFFIX: io.monitors
USING: accessors combinators concurrency.combinators destructors
fry grouping io io.backend io.ports io.streams.duplex kernel
math namespaces quotations sequences simple-tokenizer splitting
-strings system vocabs ;
+strings system vocabs vocabs.platforms ;
IN: io.pipes
TUPLE: pipe in out ;
run-pipeline-element
] 2parallel-map ;
-{
- { [ os unix? ] [ "io.pipes.unix" require ] }
- { [ os windows? ] [ "io.pipes.windows" require ] }
- [ ]
-} cond
+USE-UNIX: io.pipes.unix
+USE-WINDOWS: io.pipes.windows
USING: accessors arrays combinators io.sockets
io.sockets.private kernel sequences system
-vocabs.parser ;
+vocabs.parser vocabs.platforms ;
IN: io.sockets.icmp
-<< {
- { [ os windows? ] [ "windows.winsock" ] }
- { [ os unix? ] [ "unix.ffi" ] }
-} cond use-vocab >>
+USE-WINDOWS: windows.winsock
+USE-UNIX: unix.ffi
<PRIVATE
input/output-ports
make-input/output-secure ;
-openssl secure-socket-backend set-global
+STARTUP-HOOK: [
+ openssl secure-socket-backend set-global
+]
\ No newline at end of file
! Copyright (C) 2008, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.libraries calendar combinators delegate
-destructors io io.sockets io.sockets.private kernel memoize namespaces
-openssl.libssl present sequences summary system vocabs ;
+destructors io io.sockets io.sockets.private kernel namespaces
+present sequences summary system vocabs.platforms ;
+USE: openssl.libssl
IN: io.sockets.secure
SYMBOL: secure-socket-timeout
HOOK: accept-secure-handshake secure-socket-backend ( -- )
-{
- { [ os unix? ] [ "io.sockets.secure.unix" require ] }
- { [ os windows? ] [ "io.sockets.secure.windows" require ] }
-} cond
+USE-UNIX: io.sockets.secure.unix
+USE-WINDOWS: io.sockets.secure.windows
USING: accessors alien.c-types alien.data alien.strings arrays
byte-arrays classes classes.struct combinators
combinators.short-circuit continuations destructors endian fry
-grouping init io.backend io.encodings.ascii
-io.encodings.binary io.pathnames io.ports io.streams.duplex
-kernel locals math math.parser memoize namespaces present
-sequences sequences.private splitting strings summary system
-vocabs vocabs.parser ip-parser ip-parser.private random ;
+grouping init io.backend io.encodings.ascii io.encodings.binary
+io.pathnames io.ports io.streams.duplex ip-parser
+ip-parser.private kernel locals math math.parser
+memoize namespaces present random sequences sequences.private
+splitting strings summary system vocabs vocabs.parser
+vocabs.platforms ;
IN: io.sockets
-<< {
- { [ os windows? ] [ "windows.winsock" ] }
- { [ os unix? ] [ "unix.ffi" ] }
-} cond use-vocab >>
+USE-UNIX: unix.ffi
GENERIC#: with-port 1 ( addrspec port -- addrspec )
: broadcast-once ( bytes addrspec -- )
[ send ] with-any-port-local-broadcast ;
-{
- { [ os unix? ] [ "io.sockets.unix" require ] }
- { [ os windows? ] [ "io.sockets.windows" require ] }
-} cond
+USE-UNIX: io.sockets.unix
+USE-WINDOWS: io.sockets.windows
+USE-WINDOWS: windows.winsock
byte-arrays classes.struct combinators destructors io.backend.unix
io.encodings.ascii io.encodings.utf8 io.files io.pathnames io.sockets
io.sockets.private kernel libc locals math namespaces sequences system
-unix unix.ffi vocabs ;
+unix unix.ffi vocabs vocabs.platforms ;
IN: io.sockets.unix
: socket-fd ( domain type protocol -- fd )
256 [ <byte-array> dup ] keep gethostname io-error
ascii alien>string ;
-os linux? [ "io.sockets.unix.linux" require ] when
+USE-LINUX: io.sockets.unix.linux
\ No newline at end of file
! Copyright (C) 2011 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: combinators io.pathnames kernel sequences system
-vocabs ;
+vocabs vocabs.platforms ;
IN: io.standard-paths
HOOK: find-native-bundle os ( string -- path )
[ append-path ] [ 2drop f ] if
] if-empty ;
-{
- { [ os windows? ] [ "io.standard-paths.windows" ] }
- { [ os unix? ] [ "io.standard-paths.unix" ] }
-} cond require
-
-os macosx? [ "io.standard-paths.macosx" require ] when
+USE-MACOSX: io.standard-paths.macosx
+USE-UNIX: io.standard-paths.unix
+USE-WINDOWS: io.standard-paths.windows
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien alien.c-types alien.destructors
alien.syntax destructors destructors.private kernel math
-namespaces sequences sets summary system vocabs ;
+namespaces sequences sets summary system vocabs vocabs.platforms ;
IN: libc
HOOK: strerror os ( errno -- str )
DESTRUCTOR: free
! For libc.linux, libc.windows, libc.macosx...
-<< "libc." os name>> append require >>
+USE-OS-SUFFIX: libc
SYNTAX: LH{ \ } [ check-hashtable >linked-hash ] parse-literal ;
-{ "linked-assocs" "prettyprint" } "linked-assocs.prettyprint" require-when
+USE-WHEN-LOADED: linked-assocs.prettyprint { "linked-assocs" "prettyprint" }
: without-fp-traps ( quot -- )
{ } swap with-fp-traps ; inline
+! USE-X86: math.floats.env.x86
+! USE-PPC: math.floats.env.ppc
+
{
{ [ cpu x86? ] [ "math.floats.env.x86" require ] }
{ [ cpu ppc? ] [ "math.floats.env.ppc" require ] }
M: x87-env (set-denormal-mode)
drop ;
-cpu {
- { x86.32 [ "math.floats.env.x86.32" ] }
- { x86.64 [ "math.floats.env.x86.64" ] }
-} case require
+USE-X86-32: math.floats.env.x86.32
+USE-X86-64: math.floats.env.x86.64
\ No newline at end of file
! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel arrays sequences math math.vectors accessors
-parser ;
+parser vocabs.loader ;
IN: math.rectangles
TUPLE: rect { loc initial: { 0 0 } } { dim initial: { 0 0 } } ;
[ [ dim>> ] dip dim<< ]
2bi ; inline
-USE: vocabs.loader
-
-{ "math.rectangles" "prettyprint" } "math.rectangles.prettyprint" require-when
+USE-WHEN-LOADED: math.rectangles.prettyprint { "math.rectangles" "prettyprint" }
USING: alien alien.syntax alien.parser combinators
kernel parser sequences system words namespaces hashtables init
-math arrays assocs continuations lexer fry locals vocabs.parser ;
+math arrays assocs continuations lexer fry locals vocabs.parser
+vocabs.platforms ;
IN: opengl.gl.extensions
-ERROR: unknown-gl-platform ;
-<< {
- { [ os windows? ] [ "opengl.gl.windows" ] }
- { [ os macosx? ] [ "opengl.gl.macosx" ] }
- { [ os unix? ] [ "opengl.gl.gtk" ] }
- [ unknown-gl-platform ]
-} cond use-vocab >>
+USE-WINDOWS: opengl.gl.windows
+USE-MACOSX: opengl.gl.macosx
+! We can't have two gl-function-context in scope here
+! so load either macosx or unix
+<!MACOSX
+ USE-UNIX: opengl.gl.gtk
+!MACOSX>
SYMBOL: +gl-function-counter+
SYMBOL: +gl-function-pointers+
IN: openssl.libcrypto
-<< "libcrypto" {
- { [ os windows? ] [ "libcrypto-37.dll" ] }
- { [ os macosx? ] [ "libcrypto.35.dylib" ] }
- { [ os unix? ] [ "libcrypto.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: libcrypto cdecl "libcrypto.so"
+LIBRARY-MACOSX: libcrypto cdecl "libcrypto.35.dylib"
+LIBRARY-WINDOWS: libcrypto cdecl "libcrypto-37.dll"
STRUCT: bio-method
{ type int }
SLOT: alpn-supported-protocols
IN: openssl.libssl
-<< "libssl" {
- { [ os windows? ] [ "libssl-38.dll" ] }
- { [ os macosx? ] [ "libssl.35.dylib" ] }
- { [ os unix? ] [ "libssl.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: libssl cdecl "libssl.so"
+LIBRARY-MACOSX: libssl cdecl "libssl.35.dylib"
+LIBRARY-WINDOWS: libssl cdecl "libssl-38.dll"
CONSTANT: X509_FILETYPE_PEM 1
CONSTANT: X509_FILETYPE_ASN1 2
LIBRARY: pango.cairo
-<< "pango.cairo" {
- { [ os windows? ] [ "libpangocairo-1.0-0.dll" ] }
- { [ os macosx? ] [ "libpangocairo-1.0.dylib" ] }
- { [ os unix? ] [ "libpangocairo-1.0.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: pango.cairo cdecl "libpangocairo-1.0.so"
+LIBRARY-MACOSX: pango.cairo cdecl "libpangocairo-1.0.dylib"
+LIBRARY-WINDOWS: pango.cairo cdecl "libpangocairo-1.0-0.dll"
FOREIGN-RECORD-TYPE: cairo.Context cairo_t
FOREIGN-RECORD-TYPE: cairo.ScaledFont cairo_scaled_font_t
LIBRARY: pango
-<< "pango" {
- { [ os windows? ] [ "libpango-1.0-0.dll" ] }
- { [ os macosx? ] [ "libpango-1.0.dylib" ] }
- { [ os unix? ] [ "libpango-1.0.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: pango cdecl "libpango-1.0.so"
+LIBRARY-MACOSX: pango cdecl "libpango-1.0.dylib"
+LIBRARY-WINDOWS: pango cdecl "libpango-1.0-0.dll"
IMPLEMENT-STRUCTS: PangoRectangle ;
] append!
] ;
-{ "debugger" "peg" } "peg.debugger" require-when
+USE-WHEN-LOADED: peg.debugger { "debugger" "peg" }
hashtables hashtables.private hash-sets hints io.backend kernel
locals math math.bitwise math.constants math.functions
math.order ranges namespaces sequences sequences.private
-sets summary system typed vocabs ;
+sets summary system typed vocabs vocabs.platforms ;
QUALIFIED-WITH: alien.c-types c
QUALIFIED-WITH: sets sets
IN: random
[ 1 + ] 2dip [ _ (random-unit) log neg + ] dip
] while 2drop ;
-{
- { [ os windows? ] [ "random.windows" require ] }
- { [ os unix? ] [ "random.unix" require ] }
-} cond
+USE-WINDOWS: random.windows
+USE-UNIX: random.unix
"random.mersenne-twister" require
HINTS: M\ unix-random random-bytes* { fixnum unix-random } ;
-STARTUP-HOOK: [
- "/dev/random" <unix-random> &dispose
- secure-random-generator set-global
+! STARTUP-HOOK: [
+! "/dev/random" <unix-random> &dispose
+! secure-random-generator set-global
- "/dev/urandom" <unix-random> &dispose
- system-random-generator set-global
-]
+! "/dev/urandom" <unix-random> &dispose
+! system-random-generator set-global
+! ]
SYNTAX: R/ parse-regexp ;
-
-{ "prettyprint" "regexp" } "regexp.prettyprint" require-when
+USE-WHEN-LOADED: regexp.prettyprint { "prettyprint" "regexp" }
SYNTAX: SPECIALIZED-ARRAY:
scan-c-type define-array-vocab use-vocab ;
-{ "specialized-arrays" "prettyprint" } "specialized-arrays.prettyprint" require-when
+USE-WHEN-LOADED: specialized-arrays.prettyprint { "specialized-arrays" "prettyprint" }
-{ "specialized-arrays" "mirrors" } "specialized-arrays.mirrors" require-when
+USE-WHEN-LOADED: specialized-arrays.mirrors { "specialized-arrays" "mirrors" }
uchar define-array-vocab drop
[ define-array-vocab use-vocab ]
[ define-vector-vocab use-vocab ] bi ;
-{ "specialized-vectors" "mirrors" } "specialized-vectors.mirrors" require-when
+USE-WHEN-LOADED: specialized-vectors.mirrors { "specialized-vectors" "mirrors" }
ERROR: unbalanced-branches-error < inference-error word quots declareds actuals ;
-{ "stack-checker.errors" "debugger" } "stack-checker.errors.prettyprint" require-when
+USE-WHEN-LOADED: stack-checker.errors.prettyprint { "stack-checker.errors" "debugger" }
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors io kernel math math.parser sequences system
-vocabs ;
+vocabs vocabs.platforms ;
IN: system-info
HOOK: os-version os ( -- version )
"CPU Speed: " write cpu-mhz ghz nl
"Physical RAM: " write physical-mem megs nl ;
-"system-info." os name>> append require
+USE-OS-SUFFIX: system-info
{
"IN:" "USE:" "UNUSE:" "QUALIFIED:"
"QUALIFIED-WITH:" "FROM:" "EXCLUDE:"
+ "REUSE:"
} member? ; inline
: complete-single-vocab? ( tokens -- ? )
! See http://factorcode.org/license.txt for BSD license.
USING: combinators command-line io.directories kernel namespaces
sequences system tools.deploy.backend tools.deploy.config
-tools.deploy.config.editor vocabs vocabs.loader ;
+tools.deploy.config.editor vocabs vocabs.loader vocabs.platforms ;
IN: tools.deploy
ERROR: no-vocab-main vocab ;
[ vm-path ] 2dip
swap dup deploy-config make-deploy-image drop ;
-{
- { [ os macosx? ] [ "tools.deploy.macosx" ] }
- { [ os windows? ] [ "tools.deploy.windows" ] }
- { [ os unix? ] [ "tools.deploy.unix" ] }
-} cond require
+USE-MACOSX: tools.deploy.macosx
+USE-UNIX: tools.deploy.unix
+USE-WINDOWS: tools.deploy.windows
: deploy-main ( -- )
command-line get [ [ require ] [ deploy ] bi ] each ;
tools.disassembler.private tools.disassembler.utils tools.memory ;
IN: tools.disassembler.udis
-<< "libudis86" {
- { [ os windows? ] [ "libudis86.dll" ] }
- { [ os macosx? ] [ "libudis86.dylib" ] }
- { [ os unix? ] [ "libudis86.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: libudis86 cdecl "libudis86.so"
+LIBRARY-MACOSX: libudis86 cdecl "libudis86.dylib"
+LIBRARY-WINDOWS: libudis86 cdecl "libudis86.dll"
LIBRARY: libudis86
USING: accessors arrays calendar calendar.english
calendar.format combinators io.directories io.files.info kernel
math math.parser prettyprint sequences sorting.slots splitting
-system vocabs ;
+system vocabs vocabs.platforms ;
IN: tools.files
<PRIVATE
: file-systems. ( -- )
default-file-systems-spec print-file-systems ;
-{
- { [ os unix? ] [ "tools.files.unix" ] }
- { [ os windows? ] [ "tools.files.windows" ] }
-} cond require
+USE-UNIX: tools.files.unix
+USE-WINDOWS: tools.files.unix
! Copyright (C) 2012-2013 Doug Coleman, John Benediktsson.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors prettyprint sequences sorting system vocabs ;
+USING: accessors prettyprint sequences sorting system vocabs
+vocabs.platforms ;
IN: tools.ps
HOOK: ps os ( -- assoc )
-"tools.ps." os name>> append require
+USE-OS-SUFFIX: tools.ps
: ps. ( -- )
ps sort-keys { "PID" "CMD" } prefix simple-table. ;
classes.struct combinators combinators.short-circuit definitions
effects effects.parser fry generalizations kernel kernel.private
locals locals.parser macros quotations sequences slots
-stack-checker.dependencies words ;
+stack-checker.dependencies vocabs.loader words ;
FROM: classes.tuple.private => tuple-layout ;
IN: typed
SYNTAX: TYPED::
(::) define-typed ;
-USE: vocabs.loader
-
-{ "typed" "prettyprint" } "typed.prettyprint" require-when
-{ "typed" "compiler.cfg.debugger" } "typed.debugger" require-when
+USE-WHEN-LOADED: typed.prettyprint { "typed" "prettyprint" }
+USE-WHEN-LOADED: typed.debugger { "typed" "compiler.cfg.debugger" }
gtk-ui-backend ui-backend set-global
] when
-{ "ui.backend.gtk" "ui.gadgets.editors" }
-"ui.backend.gtk.input-methods.editors" require-when
-
M: gtk-ui-backend ui-backend-available?
"DISPLAY" os-env >boolean ;
+
+USE-WHEN-LOADED: ui.backend.gtk.input-methods.editors { "ui.backend.gtk" "ui.gadgets.editors" }
M: gadget preedit? drop f ;
-{ "ui.gadgets" "prettyprint" } "ui.gadgets.prettyprint" require-when
+USE-WHEN-LOADED: ui.gadgets.prettyprint { "ui.gadgets" "prettyprint" }
[ cached-line metrics>> scale-metrics ]
if-empty ;
-core-text-renderer font-renderer set-global
+STARTUP-HOOK: [
+ core-text-renderer font-renderer set-global
+]
\ No newline at end of file
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs cache combinators fonts kernel
math math.order namespaces opengl opengl.gl opengl.textures
-sequences strings system ui.gadgets.worlds vocabs ;
+sequences strings system ui.gadgets.worlds vocabs
+vocabs.platforms ;
IN: ui.text
<PRIVATE
] with each
] do-matrix ;
-{
- { [ os macosx? ] [ "core-text" ] }
- { [ os windows? ] [ "uniscribe" ] }
- { [ os unix? ] [ "pango" ] }
-} cond "ui.text." prepend require
+USE-MACOSX: ui.text.core-text
+<!MACOSX
+ USE-UNIX: ui.text.pango
+!MACOSX>
+USE-WINDOWS: ui.text.uniscribe
\ No newline at end of file
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien alien.c-types alien.data alien.libraries
alien.syntax classes.struct sequences system unix.time
-unix.types vocabs ;
+unix.types vocabs vocabs.platforms ;
IN: unix.ffi
-<< "unix.ffi." os name>> append require >>
+USE-OS-SUFFIX: unix.ffi
CONSTANT: PROT_NONE 0
CONSTANT: PROT_READ 1
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types alien.syntax system sequences vocabs.loader words
-accessors vocabs ;
+accessors vocabs vocabs.platforms ;
IN: unix.kqueue
-<< "unix.kqueue." os name>> append require >>
+USE-OS-SUFFIX: unix.kqueue
FUNCTION: int kqueue ( )
! Copyright (C) 2022 Cat Stevens.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors sequences system vocabs ;
+USING: accessors sequences system vocabs vocabs.platforms ;
IN: unix.scheduler
-<< "unix.scheduler." os name>> append require >>
+USE-OS-SUFFIX: unix.scheduler
USING: accessors alien.c-types alien.syntax classes.struct
-kernel sequences system unix vocabs ;
+kernel sequences system unix vocabs vocabs.platforms ;
IN: unix.stat
! File Types
TYPEDEF: fsid __fsid_t
TYPEDEF: fsid fsid_t
-<< "unix.stat." os name>> append require >>
+USE-OS-SUFFIX: unix.stat
: file-status ( pathname -- stat )
\ stat new [ [ stat-func ] unix-system-call drop ] keep ;
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors sequences system vocabs ;
+USING: accessors sequences system vocabs vocabs.platforms ;
IN: unix.statvfs
-"unix.statvfs." os name>> append require
+USE-OS-SUFFIX: unix.statvfs
-USING: accessors alien.c-types alien.syntax system vocabs ;
+USING: accessors alien.c-types alien.syntax system vocabs
+vocabs.platforms ;
QUALIFIED: sequences
IN: unix.types
C-TYPE: rusage
C-TYPE: sockaddr
-"unix.types." os name>> sequences:append require
+USE-OS-SUFFIX: unix.types
: unlink-file ( path -- ) [ unlink ] unix-system-call drop ;
-{ "unix" "debugger" } "unix.debugger" require-when
+USE-WHEN-LOADED: unix.debugger { "unix" "debugger" }
! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs combinators continuations kernel math
math.parser namespaces sequences strings system unix unix.ffi
-vocabs ;
+vocabs vocabs.platforms ;
QUALIFIED: unix.ffi
IN: unix.users
: user-home ( name/uid -- path )
dup user-passwd [ nip dir>> ] [ no-such-user ] if* ;
-os macosx? [ "unix.users.macosx" require ] when
+USE-MACOSX: unix.users.macosx
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types alien.data alien.syntax
continuations io.encodings.string io.encodings.utf8 kernel
-sequences system unix.ffi vocabs ;
+sequences system unix.ffi vocabs vocabs.platforms ;
IN: unix.utmpx
CONSTANT: EMPTY 0
produce nip
] with-utmpx ;
-"unix.utmpx." os name>> append require
+USE-OS-SUFFIX: unix.utmpx
! Literal syntax
SYNTAX: URL" lexer get skip-blank parse-string >url suffix! ;
-{ "urls" "prettyprint" } "urls.prettyprint" require-when
+USE-WHEN-LOADED: urls.prettyprint { "urls" "prettyprint" }
SYNTAX: VA{ \ } [ >valist ] parse-literal ;
-{ "vlists" "prettyprint" } "vlists.prettyprint" require-when
+USE-WHEN-LOADED: vlists.prettyprint { "vlists" "prettyprint" }
! Copyright (C) 2018 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors compiler.units kernel lexer multiline parser
-sequences splitting system vocabs.parser ;
+USING: accessors arrays compiler.units kernel lexer multiline
+namespaces parser sequences sets splitting system vocabs
+vocabs.loader.private vocabs.parser ;
IN: vocabs.platforms
: with-vocabulary ( quot suffix -- )
SYNTAX: USE-LINUX: scan-token os linux? [ use-vocab ] [ drop ] if ;
SYNTAX: USE-MACOSX: scan-token os macosx? [ use-vocab ] [ drop ] if ;
SYNTAX: USE-WINDOWS: scan-token os windows? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-OS-SUFFIX: scan-token os name>> "." glue require ;
-SYNTAX: USE-X86-32: scan-token os x86.32? [ use-vocab ] [ drop ] if ;
-SYNTAX: USE-X86-64: scan-token os x86.64? [ use-vocab ] [ drop ] if ;
-SYNTAX: USE-ARM-32: scan-token os arm.32? [ use-vocab ] [ drop ] if ;
-SYNTAX: USE-ARM-64: scan-token os arm.64? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-X86: scan-token cpu x86? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-X86-32: scan-token cpu x86.32? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-X86-64: scan-token cpu x86.64? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-ARM: scan-token cpu arm? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-ARM-32: scan-token cpu arm.32? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-ARM-64: scan-token cpu arm.64? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-PPC: scan-token cpu ppc? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-PPC-32: scan-token cpu ppc.32? [ use-vocab ] [ drop ] if ;
+SYNTAX: USE-PPC-64: scan-token cpu ppc.64? [ use-vocab ] [ drop ] if ;
SYNTAX: USE-IF: scan-token scan-object call( -- ? ) [ use-vocab ] [ drop ] if ;
+
+SYNTAX: WHEN-UNIX: scan-object os unix? [ call( -- ) ] [ drop ] if ;
+SYNTAX: WHEN-FREEBSD: scan-object os freebsd? [ call( -- ) ] [ drop ] if ;
+SYNTAX: WHEN-LINUX: scan-object os linux? [ call( -- ) ] [ drop ] if ;
+SYNTAX: WHEN-MACOSX: scan-object os macosx? [ call( -- ) ] [ drop ] if ;
+SYNTAX: WHEN-WINDOWS: scan-object os windows? [ call( -- ) ] [ drop ] if ;
+
+SYNTAX: IF-UNIX: scan-object scan-object os unix? -rot ? call( -- ) ;
+SYNTAX: IF-FREEBSD: scan-object scan-object os freebsd? -rot ? call( -- ) ;
+SYNTAX: IF-LINUX: scan-object scan-object os linux? -rot ? call( -- ) ;
+SYNTAX: IF-MACOSX: scan-object scan-object os macosx? -rot ? call( -- ) ;
+SYNTAX: IF-WINDOWS: scan-object scan-object os windows? -rot ? call( -- ) ;
! Copyright (C) 2011 John Benediktsson
! See http://factorcode.org/license.txt for BSD license
USING: accessors command-line io.pathnames kernel namespaces
-sequences strings system ui.operations urls vocabs ;
+sequences strings system ui.operations urls vocabs vocabs.platforms ;
IN: webbrowser
HOOK: open-item os ( item -- )
-"webbrowser." os name>> append require
+USE-OS-SUFFIX: webbrowser
: open-url ( url -- )
>url open-item ;
alien.parser effects kernel windows.ole32 parser lexer splitting
grouping sequences namespaces assocs quotations generalizations
accessors words macros alien.syntax fry arrays layouts math
-classes.struct windows.kernel32 locals ;
+classes.struct windows.kernel32 locals vocabs.loader ;
FROM: alien.parser.private => parse-pointers ;
IN: windows.com.syntax
SYNTAX: GUID: scan-token string>guid suffix! ;
-USE: vocabs.loader
-
-{ "windows.com" "prettyprint" } "windows.com.prettyprint" require-when
+USE-WHEN-LOADED: windows.com.prettyprint { "windows.com" "prettyprint" }
FROM: alien.c-types => short ;
IN: windows.winsock
-<<
-! Some differences between Win32 and Win64
-cpu x86.64? "windows.winsock.64" "windows.winsock.32" ? use-vocab
->>
+USE-X86-64: windows.winsock.64
+USE-X86-32: windows.winsock.32
TYPEDEF: int* SOCKET
: with-x ( display-string quot -- )
[ init-x ] dip [ close-x ] finally ; inline
-{ "x11" "io.backend.unix" } "x11.io.unix" require-when
+USE-WHEN-LOADED: x11.io.unix { "x11" "io.backend.unix" }
UNION: xml-error
unclosed multitags notags pre/post-content generated-xml-error ;
-{ "xml.errors" "debugger" } "xml.errors.debugger" require-when
+USE-WHEN-LOADED: xml.errors.debugger { "xml.errors" "debugger" }
USE: vocabs.loader
-{ "xml.syntax" "inverse" } "xml.syntax.inverse" require-when
+USE-WHEN-LOADED: xml.syntax.inverse { "xml.syntax" "inverse" }
{ "hashtables.identity" "prettyprint" } "hashtables.identity.prettyprint" require-when
{ "hashtables.identity" "mirrors" } "hashtables.identity.mirrors" require-when
+
+! USE-WHEN-LOADED: hashtables.identity.prettyprint { "hashtables.identity" "prettyprint" }
+! USE-WHEN-LOADED: hashtables.identity.mirrors { "hashtables.identity" "mirrors" }
INSTANCE: wrapped-hashtable assoc
{ "hashtables.wrapped" "prettyprint" } "hashtables.wrapped.prettyprint" require-when
+
+! USE-WHEN-LOADED: hashtables.wrapped.prettyprint { "hashtables.wrapped" "prettyprint" }
{ "locals" "prettyprint" } "locals.definitions" require-when
{ "locals" "prettyprint" } "locals.prettyprint" require-when
+! USE-WHEN-LOADED: locals.definitions { "locals" "prettyprint" }
+! USE-WHEN-LOADED: locals.prettyprint { "locals" "prettyprint" }
! Copyright (C) 2007, 2010 Eduardo Cavazos, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs combinators continuations
-definitions init io io.files io.pathnames kernel make namespaces
-parser sequences sets splitting strings vocabs words ;
+definitions init io io.files io.pathnames kernel lexer make
+namespaces parser sequences sets splitting strings vocabs words ;
IN: vocabs.loader
SYMBOL: vocab-roots
M: vocab-spec where vocab-source-path dup [ 1 2array ] when ;
+SYNTAX: USE-WHEN-LOADED:
+ scan-token
+ scan-object
+ dup [ lookup-vocab ] all? [
+ drop require
+ ] [
+ [ nip require-when-vocabs get adjoin-all ]
+ [ swap 2array require-when-table get push ] 2bi
+ ] if ;
+
! put here to avoid circularity between vocabs.loader and source-files.errors
{ "source-files.errors" "debugger" } "source-files.errors.debugger" require-when
+! USE-WHEN-LOADED: source-files.errors.debugger { "source-files.errors" "debugger" }
{ "vocabs.loader.test.o" "vocabs.loader.test.m" }
"vocabs.loader.test.n" require-when
+
+! USE-WHEN-LOADED: vocabs.loader.test.n { "vocabs.loader.test.o" "vocabs.loader.test.m" }
SPECIALIZED-ARRAY: void*
IN: chipmunk.ffi
-<<
-"chipmunk" {
- { [ os windows? ] [ "chipmunk.dll" ] }
- { [ os macosx? ] [ "libchipmunk.dylib" ] }
- { [ os unix? ] [ "libchipmunk.so" ] }
-} cond cdecl add-library
-
-"chipmunk" deploy-library
->>
+LIBRARY-WINDOWS: chipmunk cdecl "chipmunk.dll"
+LIBRARY-UNIX: chipmunk cdecl "libchipmunk.so"
+LIBRARY-MACOSX: chipmunk cdecl "libchipmunk.dylib"
+
+DEPLOY-LIBRARY: chipmunk
+
LIBRARY: chipmunk
! chipmunk_types.h
LIBRARY: clutter.cally
-<<
-"clutter.cally" {
- { [ os windows? ] [ drop ] }
- { [ os macosx? ] [ drop ] }
- { [ os unix? ] [ "libclutter-glx-1.0.so" cdecl add-library ] }
-} cond
->>
+LIBRARY-UNIX: clutter.cally cdecl "libclutter-glx-1.0.so"
GIR: Cally-1.0.gir
LIBRARY: clutter.cogl
-<<
-"clutter.cogl" {
- { [ os windows? ] [ drop ] }
- { [ os macosx? ] [ drop ] }
- { [ os unix? ] [ "libclutter-glx-1.0.so" cdecl add-library ] }
-} cond
->>
+LIBRARY-UNIX: clutter.cogl cdecl "libclutter-glx-1.0.so"
FOREIGN-ATOMIC-TYPE: GL.uint GLuint
FOREIGN-ATOMIC-TYPE: GL.enum GLenum
LIBRARY: clutter
-<<
-"clutter" {
- { [ os windows? ] [ drop ] }
- { [ os macosx? ] [ drop ] }
- { [ os unix? ] [ "libclutter-glx-1.0.so" cdecl add-library ] }
-} cond
->>
+LIBRARY-UNIX: clutter cdecl "libclutter-glx-1.0.so"
FOREIGN-RECORD-TYPE: cairo.Path cairo_path_t
LIBRARY: clutter.gtk
-<<
-"clutter.gtk" {
- { [ os windows? ] [ drop ] }
- { [ os macosx? ] [ drop ] }
- { [ os unix? ] [ "libclutter-gtk-1.0.so" cdecl add-library ] }
-} cond
->>
+LIBRARY-UNIX: clutter.gtk cdecl "libclutter-gtk-1.0.so"
GIR: GtkClutter-1.0.gir
LIBRARY: clutter.json
-<<
-"clutter.json" {
- { [ os windows? ] [ drop ] }
- { [ os macosx? ] [ drop ] }
- { [ os unix? ] [ "libclutter-glx-1.0.so" cdecl add-library ] }
-} cond
->>
+LIBRARY-UNIX: clutter.json cdecl "libclutter-glx-1.0.so"
GIR: Json-1.0.gir
classes.struct combinators kernel system ;
IN: cuda.ffi
-<<
-"cuda" {
- { [ os windows? ] [ "nvcuda.dll" stdcall ] }
- { [ os macosx? ] [ "/usr/local/cuda/lib/libcuda.dylib" cdecl ] }
- { [ os unix? ] [ "libcuda.so" cdecl ] }
-} cond add-library
->>
+LIBRARY-UNIX: cuda cdecl "libcuda.so"
+LIBRARY-MACOSX: cuda cdecl "/usr/local/cuda/lib/libcuda.dylib"
+LIBRARY-WINDOWS: cuda stdcall "nvcuda.dll"
LIBRARY: cuda
normalize-path <cuda-library>
dup name>> cuda-libraries get-global set-at ;
-{ "cuda.libraries" "prettyprint" } "cuda.prettyprint" require-when
+USE-WHEN-LOADED: cuda.prettyprint { "cuda.libraries" "prettyprint" }
IN: curl.ffi
-<< "curl" {
- { [ os macosx? ] [ "libcurl.dylib" ] }
- { [ os unix? ] [ "libcurl.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: curl cdecl "libcurl.so"
+LIBRARY-MACOSX: curl cdecl "libcurl.dylib"
LIBRARY: curl
{ [ os unix? ] [ "ncursesw" find-library ] }
} cond cdecl add-library >>
+<!MACOSX
+LIBRARY-UNIX: curses cdecl $[ "ncursesw" find-library ]
+!MACOSX>
+LIBRARY-MACOSX: curses cdecl "libcurses.dylib"
+LIBRARY-WINDOWS: curses cdecl "libcurses.dll"
+
C-TYPE: SCREEN
TYPEDEF: void* va_list
USING: accessors arrays assocs combinators command-line
environment formatting fry io.launcher kernel locals math
-namespaces sequences splitting strings system ui vocabs ;
+namespaces sequences splitting strings system ui vocabs
+vocabs.platforms ;
IN: elevate
<PRIVATE
: elevate ( win-console? posix-graphical? -- ) [ (command-line) t ] 2dip elevated drop ;
-os unix? [ "elevate.unix" require ] when
-
-{
- { [ os windows? ] [ "elevate.windows" require ] }
- { [ os linux? ] [ "elevate.linux" require ] }
- { [ os macosx? ] [ "elevate.macosx" require ] }
-} cond
+USE-UNIX: elevate.unix
+USE-WINDOWS: elevate.windows
+USE-LINUX: elevate.linux
+USE-MACOSX: elevate.macosx
! Copyright (C) 2014 John Benediktsson.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors sequences system vocabs ;
+USING: accessors sequences system vocabs vocabs.platforms ;
IN: file-picker
HOOK: open-file-dialog os ( -- paths )
HOOK: save-file-dialog os ( path -- paths )
-os name>> "file-picker." prepend require
+USE-OS-SUFFIX: file-picker
-USING: kernel listener system vocabs ;
+USING: kernel listener system vocabs vocabs.platforms ;
IN: fuel.listener
HOOK: fuel-pty-setup os ( -- )
M: object fuel-pty-setup ;
-os linux? [ "fuel.listener.linux" require ] when
+USE-LINUX: fuel.listener.linux
: fuel-listener ( -- )
fuel-pty-setup listener-main ;
M: game-loop dispose
stop-loop ;
-{ "game.loop" "prettyprint" } "game.loop.prettyprint" require-when
-{ "game.loop" "tools.memory" } "game.loop.benchmark" require-when
+USE-WHEN-LOADED: game.loop.prettyprint { "game.loop" "prettyprint" }
+USE-WHEN-LOADED: game.loop.benchmark { "game.loop" "tools.memory" }
[ world>> ] [ program>> instances>> ] [ ] tri ?delete-at
reset-memos ;
-{ "gpu.shaders" "prettyprint" } "gpu.shaders.prettyprint" require-when
+USE-WHEN-LOADED: gpu.shaders.prettyprint { "gpu.shaders" "prettyprint" }
io.encodings.latin1 io.encodings.utf8 io.files
io.files.temp io.files.unique io.launcher io.standard-paths
kernel locals make namespaces sequences summary system threads
-unicode vocabs webbrowser words ;
+unicode vocabs webbrowser words vocabs.platforms ;
IN: graphviz.render
<PRIVATE
standard-formats [ define-graphviz-by-format ] each
] with-compilation-unit
-os windows? [ "graphviz.render.windows" require ] when
+USE-WINDOWS: graphviz.render.windows
HOOK: send-to-trash os ( path -- )
-{
- { [ os windows? ] [ "io.files.trash.windows" ] }
- { [ os macosx? ] [ "io.files.trash.macosx" ] }
- { [ os unix? ] [ "io.files.trash.unix" ] }
-} cond require
+USE-MACOSX: io.files.trash.macosx
+USE-UNIX: io.files.trash.unix
+USE-WINDOWS: io.files.trash.windows
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors destructors io.streams.duplex kernel
-math.parser sequences summary system vocabs ;
+math.parser sequences summary system vocabs vocabs.platforms ;
IN: io.serial
TUPLE: serial-port < disposable stream path baud
: with-serial-port ( serial-port quot -- )
[ open-serial ] dip with-stream ; inline
-"io.serial." os name>> append require
+USE-OS-SUFFIX: io.serial
USING: alien alien.c-types alien.libraries alien.syntax
-classes.struct combinators system ;
+classes.struct combinators system vocabs.platforms ;
IN: pcre.ffi
-<< "pcre" {
- { [ os windows? ] [ "pcre.dll" ] }
- { [ os macosx? ] [ "libpcre.dylib" ] }
- { [ os unix? ] [ "libpcre.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: pcre cdecl "pcre.so"
+LIBRARY-MACOSX: pcre cdecl "libpcre.dylib"
+LIBRARY-WINDOWS: pcre cdecl "libpcre.dll"
LIBRARY: pcre
USING: alien alien.c-types alien.destructors alien.libraries
-alien.libraries.finder alien.syntax classes.struct ;
+alien.libraries.finder alien.syntax classes.struct vocabs.platforms ;
IN: python.ffi
-<< "python"
-{ "python3.10" "python3.9" "python3.8" "python3.7" } find-library-from-list
-cdecl add-library >>
+ADD-FIRST-LIBRARY: python cdecl {
+ "python3.12" "python3.11" "python3.10" "python3.9" "python3.8" "python3.7"
+}
! Functions that return borrowed references needs to be called like this:
! Py_Func dup Py_IncRef &Py_DecRef
IN: raylib
FROM: alien.c-types => float ;
-<<
-"raylib" {
- { [ os windows? ] [ "raylib.dll" ] }
- { [ os macosx? ] [ "libraylib.dylib" ] }
- { [ os unix? ] [ "libraylib.so" ] }
-} cond cdecl add-library
-
-"raylib" deploy-library
->>
+LIBRARY-UNIX: raylib cdecl "libraylib.so"
+LIBRARY-MACOSX: raylib cdecl "libraylib.dylib"
+LIBRARY-WINDOWS: raylib cdecl "raylib.dll"
+
+DEPLOY-LIBRARY: raylib
LIBRARY: raylib
sodium.ffi.const sodium.ffi.const.size_max system ;
IN: sodium.ffi
-<< "sodium" {
- { [ os windows? ] [ "libsodium.dll" ] }
- { [ os macosx? ] [ "libsodium.dylib" ] }
- { [ os unix? ] [ "libsodium.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: sodium cdecl "libsodium.so"
+LIBRARY-MACOSX: sodium cdecl "libsodium.dylib"
+LIBRARY-WINDOWS: sodium cdecl "libsodium.dll"
LIBRARY: sodium
! See http://factorcode.org/license.txt for BSD license
USING: accessors arrays environment kernel math math.parser
-sequences system vocabs ;
+sequences system vocabs vocabs.platforms ;
IN: terminal
HOOK: (terminal-size) os ( -- columns lines )
-"terminal." os name>> append require
+USE-OS-SUFFIX: terminal
: terminal-size ( -- dim )
"COLUMNS" "LINES"
HOOK: speak-text os ( str -- )
-{
- { [ os macosx? ] [ "text-to-speech.macosx" ] }
- { [ os linux? ] [ "text-to-speech.linux" ] }
- { [ os windows? ] [ "text-to-speech.windows" ] }
-} cond require
+USE-LINUX: text-to-speech.linux
+USE-MACOSX: text-to-speech.macosx
+USE-WINDOWS: text-to-speech.windows
GENERIC: speak ( obj -- )
HOOK: set-system-time os ( timestamp -- )
HOOK: adjust-time-monotonic os ( timestamp -- seconds )
-{
- { [ os windows? ] [ "time.windows" ] }
- { [ os macosx? ] [ "time.macosx" ] }
- { [ os unix? ] [ "time.unix" ] }
-} cond require
+USE-MACOSX: time.macosx
+USE-UNIX: time.unix
+USE-WINDOWS: time.windows
combinators system tokyo.alien.tcutil tokyo.alien.tctdb ;
IN: tokyo.alien.tcrdb
-<< "tokyotyrant" {
- { [ os macosx? ] [ "libtokyotyrant.dylib" ] }
- { [ os unix? ] [ "libtokyotyrant.so" ] }
- { [ os windows? ] [ "tokyotyrant.dll" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: tokyotyrant cdecl "libtokyotyrant.so"
+LIBRARY-MACOSX: tokyotyrant cdecl "libtokyotyrant.dylib"
+LIBRARY-WINDOWS: tokyotyrant cdecl "libtokyotyrant.dll"
LIBRARY: tokyotyrant
combinators system ;
IN: tokyo.alien.tcutil
-<< "tokyocabinet" {
- { [ os macosx? ] [ "libtokyocabinet.dylib" ] }
- { [ os unix? ] [ "libtokyocabinet.so" ] }
- { [ os windows? ] [ "tokyocabinet.dll" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: tokyocabinet cdecl "tokyocabinet.so"
+LIBRARY-MACOSX: tokyocabinet cdecl "tokyocabinet.dylib"
+LIBRARY-WINDOWS: tokyocabinet cdecl "tokyocabinet.dll"
LIBRARY: tokyocabinet
USING: accessors assocs classes.struct io locals math.bitwise
namespaces system tools.image-analyzer.utils tools.image-analyzer.vm
-vm vocabs.parser ;
+vm vocabs.parser vocabs.platforms ;
IN: tools.image-analyzer.data-heap-reader
FROM: alien.c-types => uchar heap-size ;
FROM: arrays => 2array ;
FROM: layouts => data-alignment ;
FROM: math => + - * align neg shift ;
-<<
-! For the two annoying structs that differ on 32 and 64 bit.
-cpu x86.32?
-"tools.image-analyzer.vm.32"
-"tools.image-analyzer.vm.64"
-? use-vocab
->>
+USE-X86-64: tools.image-analyzer.vm.64
+USE-X86-32: tools.image-analyzer.vm.32
: tag>class ( tag -- class )
{
USING: accessors alien.strings assocs classes fry graphviz
graphviz.attributes graphviz.notation math.bitwise sequences sets
system tools.image-analyzer.references tools.image-analyzer.utils
-tools.image-analyzer.vm vocabs.parser ;
+tools.image-analyzer.vm vocabs.parser vocabs.platforms ;
IN: tools.image-analyzer.graphviz
FROM: arrays => 1array 2array ;
FROM: byte-arrays => >byte-array ;
FROM: kernel => ? = 2drop bi bi* dup if keep nip object over swap tri with ;
FROM: math => <= - shift ;
-<<
-! For the two annoying structs that differ on 32 and 64 bit.
-cpu x86.32?
-"tools.image-analyzer.vm.32"
-"tools.image-analyzer.vm.64"
-? use-vocab
->>
+USE-X86-64: tools.image-analyzer.vm.64
+USE-X86-32: tools.image-analyzer.vm.32
: array>string ( array -- str )
0 suffix >byte-array alien>native-string ;
alien.libraries.finder ;
IN: yaml.ffi
-<<
-"libyaml" { "yaml" "yaml-0" "libyaml-0-2" } find-library-from-list cdecl add-library
->>
+ADD-FIRST-LIBRARY: libyaml cdecl { "yaml" "yaml-0" "libyaml-0-2" }
C-TYPE: FILE
USING: alien alien.accessors alien.c-types alien.data
alien.libraries alien.syntax assocs byte-arrays classes.struct
-combinators kernel literals math system ;
+combinators kernel literals math system vocabs.platforms ;
IN: zeromq.ffi
-<< "zmq" {
- { [ os windows? ] [ "libzmq.dll" ] }
- { [ os macosx? ] [ "libzmq.dylib" ] }
- { [ os unix? ] [ "libzmq.so" ] }
-} cond cdecl add-library >>
+LIBRARY-UNIX: zmq cdecl "libzmq.so"
+LIBRARY-MACOSX: zmq cdecl "libzmq.dylib"
+LIBRARY-WINDOWS: zmq cdecl "libzmq.dll"
LIBRARY: zmq