-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/* env.hyp | ||
* | ||
* Bootstrap environment for hyperscript | ||
* | ||
* Different OS's have different environments. | ||
* We must resolve them here. | ||
* | ||
* Modifications: | ||
* | ||
* $Log$ | ||
* Revision 1.7 2010-04-15 07:36:02 bergsma | ||
* Add undef statements | ||
* | ||
* Revision 1.6 2009-04-04 18:06:51 bergsma | ||
* Added STATE and HEARTBEAT messages | ||
* | ||
* Revision 1.5 2009-03-31 06:13:03 bergsma | ||
* Support another level of directory nesting for AUTORUN, | ||
* is used to support the override feature for interfaces | ||
* | ||
* Revision 1.4 2008-11-15 10:29:03 bergsma | ||
* no message | ||
* | ||
* Revision 1.3 2008-10-18 22:12:48 bergsma | ||
* no message | ||
* | ||
* Revision 1.2 2008-05-02 06:48:13 bergsma | ||
* no message | ||
* | ||
* | ||
* | ||
* Usage: | ||
* | ||
* In a hyperscript program, you call this file as follows: | ||
* | ||
* | ||
* parse ( (getenv("AUTORUN") + ( (env=="UNIX") ? "/" : ( (env=="WINDOWS") ? "\\" : "" ) ) + "env.hyp") ) ; | ||
* | ||
*/ | ||
|
||
str AUTORUN = getenv "AUTORUN" ; | ||
global AUTORUN ; | ||
|
||
str AUTOLOG = getenv "AUTOLOG" ; | ||
global AUTOLOG ; | ||
|
||
str AUTOSPOOL = getenv "AUTOSPOOL" ; | ||
global AUTOSPOOL ; | ||
|
||
str AUTOROUTER = getenv "AUTOROUTER" ; | ||
global AUTOROUTER ; | ||
|
||
str AUTOFIFO = getenv "AUTOFIFO" ; | ||
global AUTOFIFO ; | ||
|
||
/* What OS are we on? */ | ||
str OS = env() ; | ||
global OS ; | ||
|
||
/* Determine the directory separator to use. */ | ||
str SEPARATOR = ( (OS=="UNIX") ? "/" : ( (OS=="WINDOWS") ? "\\" : "" ) ) ; | ||
global SEPARATOR ; | ||
|
||
/* Define a useful function */ | ||
undef AUTORUN_FILE ; | ||
str AUTORUN_FILE( str filnam, str subdir="", str subdir2="", str subdir3="", str subdir4 ) | ||
{ | ||
if ( OS == "UNIX" || OS == "WINDOWS" ) { | ||
if ( subdir =="" ) return (AUTORUN + SEPARATOR + filnam) ; | ||
if ( subdir2=="" ) return (AUTORUN + SEPARATOR + subdir + SEPARATOR + filnam ) ; | ||
if ( subdir3=="" ) return (AUTORUN + SEPARATOR + subdir + SEPARATOR + subdir2 + SEPARATOR + filnam ) ; | ||
if ( subdir4=="" ) return (AUTORUN + SEPARATOR + subdir + SEPARATOR + subdir2 + SEPARATOR + subdir3 + SEPARATOR + filnam ) ; | ||
return (AUTORUN + SEPARATOR + subdir + SEPARATOR + subdir2 + SEPARATOR + subdir3 + SEPARATOR + subdir4 + SEPARATOR + filnam ) ; | ||
} | ||
else /* if ( OS == "VMS" ) */ { | ||
/* SEPARATOR is "", and AUTORUN assumed to end with "]" */ | ||
if ( subdir =="" ) return (AUTORUN + filnam) ; | ||
if ( subdir2=="" ) return ((AUTORUN-"]") + "." + subdir + "]" + filnam ) ; | ||
if ( subdir3=="" ) return ((AUTORUN-"]") + "." + subdir + "." + subdir2 + "]" + filnam ) ; | ||
if ( subdir4=="" ) return ((AUTORUN-"]") + "." + subdir + "." + subdir2 + "." + subdir3 + "]" + filnam ) ; | ||
return ((AUTORUN-"]") + "." + subdir + "." + subdir2 + "." + subdir3 + "." + subdir4 + "]" + filnam ) ; | ||
} | ||
} ; | ||
global AUTORUN_FILE ; | ||
|
||
undef AUTOSPOOL_FILE; | ||
str AUTOSPOOL_FILE( str filnam, str subdir="" ) | ||
{ | ||
if ( OS == "UNIX" || OS == "WINDOWS" ) { | ||
if ( subdir =="" ) return (AUTOSPOOL + SEPARATOR + filnam) ; | ||
else return (AUTOSPOOL + SEPARATOR + subdir + SEPARATOR + filnam ) ; | ||
} | ||
else /* if ( OS == "VMS" ) */ { | ||
/* SEPARATOR is "", and AUTOSPOOL assumed to end with "]" */ | ||
if ( subdir =="" ) return (AUTOSPOOL + filnam) ; | ||
else return ((AUTOSPOOL-"]") + "." + subdir + "]" + filnam ) ; | ||
} | ||
} ; | ||
global AUTOSPOOL_FILE ; | ||
|
||
|
||
/* Define a useful function */ | ||
undef AUTOLOG_FILE ; | ||
str AUTOLOG_FILE( str filnam, str subdir="" ) | ||
{ | ||
if ( OS == "UNIX" || OS == "WINDOWS" ) { | ||
if ( subdir =="" ) return (AUTOLOG + SEPARATOR + filnam) ; | ||
else return (AUTOLOG + SEPARATOR + subdir + SEPARATOR + filnam ) ; | ||
} | ||
else /* if ( OS == "VMS" ) */ { | ||
/* SEPARATOR is "", and AUTOLOG assumed to end with "]" */ | ||
if ( subdir =="" ) return (AUTOLOG + filnam) ; | ||
else return ((AUTOLOG-"]") + "." + subdir + "]" + filnam ) ; | ||
} | ||
} ; | ||
global AUTOLOG_FILE ; |