Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions basis/alien/libraries/finder/finder.factor
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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 )
Expand All @@ -21,4 +21,8 @@ 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
16 changes: 10 additions & 6 deletions basis/alien/libraries/libraries.factor
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
! 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 -- ? )
Expand Down Expand Up @@ -100,9 +100,13 @@ deploy-libraries [ V{ } clone ] initialize
[ 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
10 changes: 4 additions & 6 deletions basis/atk/ffi/ffi.factor
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
! 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
2 changes: 1 addition & 1 deletion basis/bit-arrays/bit-arrays.factor
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ SYNTAX: ?{ \ } [ >bit-array ] parse-literal ;

INSTANCE: bit-array sequence

{ "bit-arrays" "prettyprint" } "bit-arrays.prettyprint" require-when
USE-WHEN-LOADED: bit-arrays.prettyprint { "bit-arrays" "prettyprint" }
2 changes: 1 addition & 1 deletion basis/bit-vectors/bit-vectors.factor
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ SYNTAX: ?V{ \ } [ >bit-vector ] parse-literal ;

M: bit-vector contract 2drop ;

{ "bit-vectors" "prettyprint" } "bit-vectors.prettyprint" require-when
USE-WHEN-LOADED: bit-vectors.prettyprint { "bit-vectors" "prettyprint" }
1 change: 1 addition & 0 deletions basis/bootstrap/compiler/compiler.factor
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ IN: bootstrap.compiler
] unless

{ "boostrap.compiler" "prettyprint" } "alien.prettyprint" require-when
! USE-WHEN-LOADED: alien.prettyprint { "boostrap.compiler" "prettyprint" }

"cpu." cpu name>> append require

Expand Down
2 changes: 1 addition & 1 deletion basis/bootstrap/handbook/handbook.factor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
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" }
2 changes: 1 addition & 1 deletion basis/bootstrap/ui/tools/tools.factor
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ IN: bootstrap.ui.tools

"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
8 changes: 3 additions & 5 deletions basis/cairo/ffi/ffi.factor
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ IN: cairo.ffi

! 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

Expand Down
10 changes: 4 additions & 6 deletions basis/calendar/calendar.factor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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

Expand Down Expand Up @@ -826,9 +826,7 @@ M: integer weeks-in-week-year
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" }
2 changes: 1 addition & 1 deletion basis/classes/struct/struct.factor
Original file line number Diff line number Diff line change
Expand Up @@ -441,4 +441,4 @@ FUNCTOR-SYNTAX: STRUCT:
[ 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" }
2 changes: 1 addition & 1 deletion basis/colors/colors.factor
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ M: parsed-color >rgba value>> >rgba ;

SYNTAX: COLOR: scan-token dup parse-color parsed-color boa suffix! ;

{ "colors" "prettyprint" } "colors.prettyprint" require-when
USE-WHEN-LOADED: colors.prettyprint { "colors" "prettyprint" }
2 changes: 1 addition & 1 deletion basis/command-line/command-line.factor
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ STARTUP-HOOK: [
default-cli-args
]

{ "debugger" "command-line" } "command-line.debugger" require-when
USE-WHEN-LOADED: command-line.debugger { "debugger" "command-line" }
4 changes: 2 additions & 2 deletions basis/compiler/compiler.factor
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,5 @@ M: optimizing-compiler process-forgotten-words
: 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" }
8 changes: 3 additions & 5 deletions basis/compression/snappy/ffi/ffi.factor
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ USING: alien alien.c-types alien.libraries alien.syntax
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

Expand Down
8 changes: 3 additions & 5 deletions basis/compression/zlib/ffi/ffi.factor
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ USING: alien alien.c-types alien.libraries alien.syntax
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

Expand Down
8 changes: 3 additions & 5 deletions basis/compression/zstd/ffi/ffi.factor
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ USING: alien alien.c-types alien.libraries alien.syntax
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

Expand Down
2 changes: 1 addition & 1 deletion basis/concurrency/mailboxes/mailboxes.factor
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ M: linked-thread error-in-thread
: 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" }
9 changes: 4 additions & 5 deletions basis/cpu/x86/64/64.factor
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ USING: alien alien.c-types assocs combinators compiler.cfg.intrinsics
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

Expand Down Expand Up @@ -134,7 +135,5 @@ M: x86.64 (cpuid)
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
8 changes: 3 additions & 5 deletions basis/db/postgresql/ffi/ffi.factor
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ USING: alien alien.c-types alien.libraries alien.syntax
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
Expand Down
8 changes: 3 additions & 5 deletions basis/db/sqlite/ffi/ffi.factor
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ USING: alien alien.c-types alien.libraries alien.syntax
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
Expand Down
6 changes: 3 additions & 3 deletions basis/debugger/debugger.factor
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ io.encodings io.styles kernel kernel.private lexer libc make
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 )
Expand Down Expand Up @@ -380,6 +380,6 @@ M: stack-effect-omits-dashes summary drop "Stack effect must contain “--”" ;
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" }
2 changes: 1 addition & 1 deletion basis/dlists/dlists.factor
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,4 @@ INSTANCE: dlist deque

SYNTAX: DL{ \ } [ >dlist ] parse-literal ;

{ "dlists" "prettyprint" } "dlists.prettyprint" require-when
USE-WHEN-LOADED: dlists.prettyprint { "dlists" "prettyprint" }
8 changes: 3 additions & 5 deletions basis/dns/dns.factor
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ grouping io io.encodings.binary io.encodings.string
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 -- )
Expand Down Expand Up @@ -448,10 +448,8 @@ M: TXT rdata>byte-array

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
Expand Down
4 changes: 2 additions & 2 deletions basis/editors/brackets/brackets.factor
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! 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
Expand All @@ -19,4 +19,4 @@ M: macosx brackets-path
M: brackets editor-command
[ brackets-path "brackets" or , drop , ] { } make ;

os windows? [ "editors.brackets.windows" require ] when
USE-WINDOWS: editors.brackets.windows
8 changes: 3 additions & 5 deletions basis/environment/environment.factor
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! 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 )
Expand Down Expand Up @@ -29,10 +29,8 @@ HOOK: set-os-envs-pointer os ( malloc -- )
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 [
Expand Down
4 changes: 2 additions & 2 deletions basis/environment/unix/unix.factor
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
! 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* )
Expand Down Expand Up @@ -30,4 +30,4 @@ M: unix set-os-envs-pointer environ set-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
7 changes: 5 additions & 2 deletions basis/fixups/fixups.factor
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! 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 {
Expand Down Expand Up @@ -60,6 +60,9 @@ M: object compute-fixups

M: f compute-fixups 2drop { } ;

M: undefined-word compute-fixups
2drop { } ;

M: no-vocab compute-fixups
[ name>> vocab-renames compute-assoc-fixups ] [ drop { } ] if* ;

Expand Down
9 changes: 3 additions & 6 deletions basis/game/input/input.factor
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ SYMBOLS: pressed released ;
: 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
Loading