remove os-env docs and tests from core/
							parent
							
								
									5dc3bf2b27
								
							
						
					
					
						commit
						3e24ff97fe
					
				| 
						 | 
					@ -7,7 +7,6 @@ ABOUT: "system"
 | 
				
			||||||
ARTICLE: "system" "System interface"
 | 
					ARTICLE: "system" "System interface"
 | 
				
			||||||
{ $subsection "cpu" }
 | 
					{ $subsection "cpu" }
 | 
				
			||||||
{ $subsection "os" }
 | 
					{ $subsection "os" }
 | 
				
			||||||
{ $subsection "environment-variables" }
 | 
					 | 
				
			||||||
"Getting the path to the Factor VM and image:"
 | 
					"Getting the path to the Factor VM and image:"
 | 
				
			||||||
{ $subsection vm }
 | 
					{ $subsection vm }
 | 
				
			||||||
{ $subsection image }
 | 
					{ $subsection image }
 | 
				
			||||||
| 
						 | 
					@ -16,15 +15,6 @@ ARTICLE: "system" "System interface"
 | 
				
			||||||
"Exiting the Factor VM:"
 | 
					"Exiting the Factor VM:"
 | 
				
			||||||
{ $subsection exit } ;
 | 
					{ $subsection exit } ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ARTICLE: "environment-variables" "Environment variables"
 | 
					 | 
				
			||||||
"Reading environment variables:"
 | 
					 | 
				
			||||||
{ $subsection os-env }
 | 
					 | 
				
			||||||
{ $subsection os-envs }
 | 
					 | 
				
			||||||
"Writing environment variables:"
 | 
					 | 
				
			||||||
{ $subsection set-os-env }
 | 
					 | 
				
			||||||
{ $subsection unset-os-env }
 | 
					 | 
				
			||||||
{ $subsection set-os-envs } ;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
ARTICLE: "cpu" "Processor detection"
 | 
					ARTICLE: "cpu" "Processor detection"
 | 
				
			||||||
"Processor detection:"
 | 
					"Processor detection:"
 | 
				
			||||||
{ $subsection cpu }
 | 
					{ $subsection cpu }
 | 
				
			||||||
| 
						 | 
					@ -79,49 +69,6 @@ HELP: millis ( -- n )
 | 
				
			||||||
{ $description "Outputs the number of milliseconds ellapsed since midnight January 1, 1970." }
 | 
					{ $description "Outputs the number of milliseconds ellapsed since midnight January 1, 1970." }
 | 
				
			||||||
{ $notes "This is a low-level word. The " { $vocab-link "calendar" } " vocabulary provides features for date/time arithmetic and formatting." } ;
 | 
					{ $notes "This is a low-level word. The " { $vocab-link "calendar" } " vocabulary provides features for date/time arithmetic and formatting." } ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HELP: os-env ( key -- value )
 | 
					 | 
				
			||||||
{ $values { "key" string } { "value" string } }
 | 
					 | 
				
			||||||
{ $description "Looks up the value of a shell environment variable." }
 | 
					 | 
				
			||||||
{ $examples 
 | 
					 | 
				
			||||||
    "This is an operating system-specific feature. On Unix, you can do:"
 | 
					 | 
				
			||||||
    { $unchecked-example "\"USER\" os-env print" "jane" }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
{ $errors "Windows CE has no concept of environment variables, so this word throws an error there." } ;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
HELP: os-envs
 | 
					 | 
				
			||||||
{ $values { "assoc" "an association mapping strings to strings" } }
 | 
					 | 
				
			||||||
{ $description "Outputs the current set of environment variables." }
 | 
					 | 
				
			||||||
{ $notes 
 | 
					 | 
				
			||||||
    "Names and values of environment variables are operating system-specific."
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
{ $errors "Windows CE has no concept of environment variables, so this word throws an error there." } ;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
HELP: set-os-envs
 | 
					 | 
				
			||||||
{ $values { "assoc" "an association mapping strings to strings" } }
 | 
					 | 
				
			||||||
{ $description "Replaces the current set of environment variables." }
 | 
					 | 
				
			||||||
{ $notes
 | 
					 | 
				
			||||||
    "Names and values of environment variables are operating system-specific. Windows NT allows values up to 32766 characters in length."
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
{ $errors "Windows CE has no concept of environment variables, so this word throws an error there." } ;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
HELP: set-os-env ( value key -- )
 | 
					 | 
				
			||||||
{ $values { "value" string } { "key" string } }
 | 
					 | 
				
			||||||
{ $description "Set an environment variable." }
 | 
					 | 
				
			||||||
{ $notes
 | 
					 | 
				
			||||||
    "Names and values of environment variables are operating system-specific."
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
{ $errors "Windows CE has no concept of environment variables, so this word throws an error there." } ;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
HELP: unset-os-env ( key -- )
 | 
					 | 
				
			||||||
{ $values { "key" string } }
 | 
					 | 
				
			||||||
{ $description "Unset an environment variable." }
 | 
					 | 
				
			||||||
{ $notes
 | 
					 | 
				
			||||||
    "Names and values of environment variables are operating system-specific."
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
{ $errors "Windows CE has no concept of environment variables, so this word throws an error there." } ;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
{ os-env os-envs set-os-env unset-os-env set-os-envs } related-words
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
HELP: image
 | 
					HELP: image
 | 
				
			||||||
{ $values { "path" "a pathname string" } }
 | 
					{ $values { "path" "a pathname string" } }
 | 
				
			||||||
{ $description "Outputs the pathname of the currently running Factor image." } ;
 | 
					{ $description "Outputs the pathname of the currently running Factor image." } ;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,27 +0,0 @@
 | 
				
			||||||
USING: math tools.test system prettyprint namespaces kernel
 | 
					 | 
				
			||||||
strings sequences ;
 | 
					 | 
				
			||||||
IN: system.tests
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
os wince? [
 | 
					 | 
				
			||||||
    [ ] [ os-envs . ] unit-test
 | 
					 | 
				
			||||||
] unless
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
os unix? [
 | 
					 | 
				
			||||||
    [ ] [ os-envs "envs" set ] unit-test
 | 
					 | 
				
			||||||
    [ ] [ { { "A" "B" } } set-os-envs ] unit-test
 | 
					 | 
				
			||||||
    [ "B" ] [ "A" os-env ] unit-test
 | 
					 | 
				
			||||||
    [ ] [ "envs" get set-os-envs ] unit-test
 | 
					 | 
				
			||||||
    [ t ] [ os-envs "envs" get = ] unit-test
 | 
					 | 
				
			||||||
] when
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[ ] [ "factor-test-key-1" unset-os-env ] unit-test
 | 
					 | 
				
			||||||
[ ] [ "ps3" "factor-test-key-1" set-os-env ] unit-test
 | 
					 | 
				
			||||||
[ "ps3" ] [ "factor-test-key-1" os-env ] unit-test
 | 
					 | 
				
			||||||
[ ] [ "factor-test-key-1" unset-os-env ] unit-test
 | 
					 | 
				
			||||||
[ f ] [ "factor-test-key-1" os-env ] unit-test
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[ ] [
 | 
					 | 
				
			||||||
    32766 CHAR: a <string> "factor-test-key-long" set-os-env
 | 
					 | 
				
			||||||
] unit-test
 | 
					 | 
				
			||||||
[ 32766 ] [ "factor-test-key-long" os-env length ] unit-test
 | 
					 | 
				
			||||||
[ ] [ "factor-test-key-long" unset-os-env ] unit-test
 | 
					 | 
				
			||||||
		Loading…
	
		Reference in New Issue