private void InitConstants(DualDictionary<string, object> _constants)
{
// Thease constants are here, because they are environment dependent
// When the code is compiled and assembly is run on another platforms they could be different
_constants.Add("PHALANGER", PhalangerVersion.Current, false);
_constants.Add("PHP_VERSION", PhpVersion.Current, false);
_constants.Add("PHP_MAJOR_VERSION", PhpVersion.Major, false);
_constants.Add("PHP_MINOR_VERSION", PhpVersion.Minor, false);
_constants.Add("PHP_RELEASE_VERSION", PhpVersion.Release, false);
_constants.Add("PHP_VERSION_ID", PhpVersion.Major * 10000 + PhpVersion.Minor * 100 + PhpVersion.Release, false);
_constants.Add("PHP_EXTRA_VERSION", PhpVersion.Extra, false);
_constants.Add("PHP_OS", Environment.OSVersion.Platform == PlatformID.Win32NT ? "WINNT" : "WIN32", false); // TODO: GENERICS (Unix)
_constants.Add("PHP_SAPI", (System.Web.HttpContext.Current == null) ? "cli" : "isapi", false);
_constants.Add("DIRECTORY_SEPARATOR", FullPath.DirectorySeparatorString, false);
_constants.Add("PATH_SEPARATOR", Path.PathSeparator.ToString(), false);
//TODO: should be specified elsewhere (app context??)
_constants.Add("PHP_EOL", System.Environment.NewLine, false);
//TODO: this is a bit pesimistic, as this value is a bit higher on Vista and on other filesystems and OSes
// sadly .NET does not specify value of MAXPATH constant
_constants.Add("PHP_MAXPATHLEN", 255, false);
if (HttpContext.Current == null)
{
_constants.Add("STDIN", InputOutputStreamWrapper.In, false);
_constants.Add("STDOUT", InputOutputStreamWrapper.Out, false);
_constants.Add("STDERR", InputOutputStreamWrapper.Error, false);
}
}