]> gitweb.factorcode.org Git - factor.git/blob - core/system/system-docs.factor
49886492ecb12ffa17ea23483af36733b2bddab1
[factor.git] / core / system / system-docs.factor
1 USING: generic help.markup help.syntax kernel math memory
2 namespaces sequences kernel.private strings classes.singleton ;
3 IN: system
4
5 ABOUT: "system"
6
7 ARTICLE: "system" "System interface"
8 { $subsection "cpu" }
9 { $subsection "os" }
10 { $subsection "environment-variables" }
11 "Getting the path to the Factor VM and image:"
12 { $subsection vm }
13 { $subsection image }
14 "Getting the current time:"
15 { $subsection millis }
16 "Exiting the Factor VM:"
17 { $subsection exit } ;
18
19 ARTICLE: "environment-variables" "Environment variables"
20 "Reading environment variables:"
21 { $subsection os-env }
22 { $subsection os-envs }
23 "Writing environment variables:"
24 { $subsection set-os-env }
25 { $subsection unset-os-env }
26 { $subsection set-os-envs } ;
27
28 ARTICLE: "cpu" "Processor detection"
29 "Processor detection:"
30 { $subsection cpu }
31 "Supported processors:"
32 { $subsection x86.32 }
33 { $subsection x86.64 }
34 { $subsection ppc }
35 { $subsection arm }
36 "Processor families:"
37 { $subsection x86 } ;
38
39 ARTICLE: "os" "Operating system detection"
40 "Operating system detection:"
41 { $subsection os }
42 "Supported operating systems:"
43 { $subsection freebsd }
44 { $subsection linux }
45 { $subsection macosx }
46 { $subsection openbsd }
47 { $subsection netbsd }
48 { $subsection solaris }
49 { $subsection wince }
50 { $subsection winnt }
51 "Operating system families:"
52 { $subsection bsd }
53 { $subsection unix }
54 { $subsection windows } ;
55
56
57 HELP: cpu
58 { $values { "class" singleton-class } }
59 { $description
60     "Outputs a singleton class with the name of the current CPU architecture."
61 } ;
62
63 HELP: os
64 { $values { "class" singleton-class } }
65 { $description
66     "Outputs a singleton class with the name of the current operating system family."
67 } ;
68
69 HELP: embedded?
70 { $values { "?" "a boolean" } }
71 { $description "Tests if this Factor instance is embedded in another application." } ;
72
73 HELP: exit ( n -- )
74 { $values { "n" "an integer exit code" } }
75 { $description "Exits the Factor process." } ;
76
77 HELP: millis ( -- n )
78 { $values { "n" integer } }
79 { $description "Outputs the number of milliseconds ellapsed since midnight January 1, 1970." }
80 { $notes "This is a low-level word. The " { $vocab-link "calendar" } " vocabulary provides features for date/time arithmetic and formatting." } ;
81
82 HELP: os-env ( key -- value )
83 { $values { "key" string } { "value" string } }
84 { $description "Looks up the value of a shell environment variable." }
85 { $examples 
86     "This is an operating system-specific feature. On Unix, you can do:"
87     { $unchecked-example "\"USER\" os-env print" "jane" }
88 }
89 { $errors "Windows CE has no concept of environment variables, so this word throws an error there." } ;
90
91 HELP: os-envs
92 { $values { "assoc" "an association mapping strings to strings" } }
93 { $description "Outputs the current set of environment variables." }
94 { $notes 
95     "Names and values of environment variables are operating system-specific."
96 }
97 { $errors "Windows CE has no concept of environment variables, so this word throws an error there." } ;
98
99 HELP: set-os-envs
100 { $values { "assoc" "an association mapping strings to strings" } }
101 { $description "Replaces the current set of environment variables." }
102 { $notes
103     "Names and values of environment variables are operating system-specific. Windows NT allows values up to 32766 characters in length."
104 }
105 { $errors "Windows CE has no concept of environment variables, so this word throws an error there." } ;
106
107 HELP: set-os-env ( value key -- )
108 { $values { "value" string } { "key" string } }
109 { $description "Set an environment variable." }
110 { $notes
111     "Names and values of environment variables are operating system-specific."
112 }
113 { $errors "Windows CE has no concept of environment variables, so this word throws an error there." } ;
114
115 HELP: unset-os-env ( key -- )
116 { $values { "key" string } }
117 { $description "Unset an environment variable." }
118 { $notes
119     "Names and values of environment variables are operating system-specific."
120 }
121 { $errors "Windows CE has no concept of environment variables, so this word throws an error there." } ;
122
123 { os-env os-envs set-os-env unset-os-env set-os-envs } related-words
124
125 HELP: image
126 { $values { "path" "a pathname string" } }
127 { $description "Outputs the pathname of the currently running Factor image." } ;
128
129 HELP: vm
130 { $values { "path" "a pathname string" } }
131 { $description "Outputs the pathname of the currently running Factor VM." } ;