1 USING: generic help.markup help.syntax kernel math memory
2 namespaces sequences kernel.private strings classes.singleton ;
7 ARTICLE: "system" "System interface"
10 { $subsection "environment-variables" }
11 "Getting the path to the Factor VM and image:"
14 "Getting the current time:"
15 { $subsection millis }
16 "Exiting the Factor VM:"
17 { $subsection exit } ;
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 } ;
28 ARTICLE: "cpu" "Processor detection"
29 "Processor detection:"
31 "Supported processors:"
32 { $subsection x86.32 }
33 { $subsection x86.64 }
39 ARTICLE: "os" "Operating system detection"
40 "Operating system detection:"
42 "Supported operating systems:"
43 { $subsection freebsd }
45 { $subsection macosx }
46 { $subsection openbsd }
47 { $subsection netbsd }
48 { $subsection solaris }
51 "Operating system families:"
54 { $subsection windows } ;
58 { $values { "class" singleton-class } }
60 "Outputs a singleton class with the name of the current CPU architecture."
64 { $values { "class" singleton-class } }
66 "Outputs a singleton class with the name of the current operating system family."
70 { $values { "?" "a boolean" } }
71 { $description "Tests if this Factor instance is embedded in another application." } ;
74 { $values { "n" "an integer exit code" } }
75 { $description "Exits the Factor process." } ;
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." } ;
82 HELP: os-env ( key -- value )
83 { $values { "key" string } { "value" string } }
84 { $description "Looks up the value of a shell environment variable." }
86 "This is an operating system-specific feature. On Unix, you can do:"
87 { $unchecked-example "\"USER\" os-env print" "jane" }
89 { $errors "Windows CE has no concept of environment variables, so this word throws an error there." } ;
92 { $values { "assoc" "an association mapping strings to strings" } }
93 { $description "Outputs the current set of environment variables." }
95 "Names and values of environment variables are operating system-specific."
97 { $errors "Windows CE has no concept of environment variables, so this word throws an error there." } ;
100 { $values { "assoc" "an association mapping strings to strings" } }
101 { $description "Replaces the current set of environment variables." }
103 "Names and values of environment variables are operating system-specific. Windows NT allows values up to 32766 characters in length."
105 { $errors "Windows CE has no concept of environment variables, so this word throws an error there." } ;
107 HELP: set-os-env ( value key -- )
108 { $values { "value" string } { "key" string } }
109 { $description "Set an environment variable." }
111 "Names and values of environment variables are operating system-specific."
113 { $errors "Windows CE has no concept of environment variables, so this word throws an error there." } ;
115 HELP: unset-os-env ( key -- )
116 { $values { "key" string } }
117 { $description "Unset an environment variable." }
119 "Names and values of environment variables are operating system-specific."
121 { $errors "Windows CE has no concept of environment variables, so this word throws an error there." } ;
123 { os-env os-envs set-os-env unset-os-env set-os-envs } related-words
126 { $values { "path" "a pathname string" } }
127 { $description "Outputs the pathname of the currently running Factor image." } ;
130 { $values { "path" "a pathname string" } }
131 { $description "Outputs the pathname of the currently running Factor VM." } ;