]> gitweb.factorcode.org Git - factor.git/blob - library/platform/jvm/init.factor
Factor jEdit plugin!
[factor.git] / library / platform / jvm / init.factor
1 ! :folding=indent:collapseFolds=1:
2
3 ! $Id$
4 !
5 ! Copyright (C) 2004 Slava Pestov.
6
7 ! Redistribution and use in source and binary forms, with or without
8 ! modification, are permitted provided that the following conditions are met:
9
10 ! 1. Redistributions of source code must retain the above copyright notice,
11 !    this list of conditions and the following disclaimer.
12
13 ! 2. Redistributions in binary form must reproduce the above copyright notice,
14 !    this list of conditions and the following disclaimer in the documentation
15 !    and/or other materials provided with the distribution.
16
17 ! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 ! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
19 ! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20 ! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 ! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 ! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 ! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 ! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 ! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 ! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 IN: init
29 USE: combinators
30 USE: compiler
31 USE: continuations
32 USE: kernel
33 USE: lists
34 USE: interpreter
35 USE: namespaces
36 USE: parser
37 USE: stack
38 USE: stdio
39 USE: streams
40 USE: strings
41
42 : stdin ( -- stdin )
43     "java.lang.System" "in"  jvar-static-get
44     <ireader> <breader> ;
45
46 : stdout ( -- stdout )
47     "java.lang.System" "out" jvar-static-get <owriter> ;
48
49 : init-stdio ( -- )
50     #! Initialize standard input/output.
51     stdin stdout <char-stream> "stdio" set ;
52
53 : init-environment ( -- )
54     #! Initialize OS-specific constants.
55     "user.home" system-property "~" set
56     "file.separator" system-property "/" set ;
57
58 : boot ( -- )
59     #! The boot word is run by the intepreter when starting from
60     #! an object database.
61
62     ! Some flags are *on* by default, unless user specifies
63     ! -no-<flag> CLI switch
64     t "user-init" set
65     t "compile"   set
66
67     init-stdio
68     init-environment
69     init-search-path
70     init-scratchpad
71     "args" get parse-command-line
72     run-user-init
73
74     "compile" get [
75         compile-all
76     ] when
77
78     t "startup-done" set
79     
80     init-interpreter ;