bootstrap.primitives: shorter code for mapping architecture to assembly file

db4
Björn Lindqvist 2015-05-22 20:29:20 +02:00 committed by Doug Coleman
parent 48e6455186
commit 5dcaf2553f
1 changed files with 12 additions and 17 deletions

View File

@ -1,14 +1,13 @@
! Copyright (C) 2004, 2010 Slava Pestov. ! Copyright (C) 2004, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.strings arrays byte-arrays generic hashtables USING: accessors alien alien.strings arrays assocs byte-arrays classes
hashtables.private io io.encodings.ascii kernel math classes.intersection classes.union combinators generic hashtables
math.private math.order namespaces make parser sequences strings hashtables.private io io.encodings.ascii kernel math math.private math.order
vectors words quotations assocs layouts classes classes.private namespaces make parser quotations sequences strings vectors words layouts
classes.builtin classes.singleton classes.tuple classes.private classes.builtin classes.singleton classes.tuple
classes.tuple.private kernel.private vocabs vocabs.loader classes.tuple.private kernel.private vocabs vocabs.loader
source-files definitions slots classes.union source-files definitions slots classes.predicate compiler.units
classes.intersection classes.predicate compiler.units bootstrap.image.private io.files splitting ;
bootstrap.image.private io.files accessors combinators ;
IN: bootstrap.primitives IN: bootstrap.primitives
"Creating primitives and basic runtime structures..." print flush "Creating primitives and basic runtime structures..." print flush
@ -17,15 +16,11 @@ H{ } clone sub-primitives set
"vocab:bootstrap/syntax.factor" parse-file "vocab:bootstrap/syntax.factor" parse-file
architecture get { : asm-file ( arch -- file )
{ "windows-x86.32" "x86.32.windows" } "-" split reverse "." join
{ "windows-x86.64" "x86.64.windows" } "vocab:bootstrap/assembler/" ".factor" surround ;
{ "unix-x86.32" "x86.32.unix" }
{ "unix-x86.64" "x86.64.unix" } architecture get asm-file parse-file
{ "linux-ppc.32" "ppc.32.linux" }
{ "linux-ppc.64" "ppc.64.linux" }
} ?at [ "Bad architecture: " prepend throw ] unless
"vocab:bootstrap/assembler/" ".factor" surround parse-file
"vocab:bootstrap/layouts/layouts.factor" parse-file "vocab:bootstrap/layouts/layouts.factor" parse-file