/*
 * TclVars.cs --
 *
 * Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: $
 */

using System;
using Eagle._Attributes;

namespace Eagle._Components.Private
{
    [ObjectId("f48e798e-7e3a-4a21-b27b-3d20d30c91bf")]
    internal static class TclVars
    {
        //
        // NOTE: These names are referred to directly from scripts and where applicable
        //       are named identically to their Tcl counterparts, please do not change.
        //
        [ObjectId("17c544ad-f0f2-415c-af5c-ec7cb6bd88f0")]
        internal static class Platform
        {
            //
            // NOTE: The name of the script array that contains the
            //       Tcl compatible platform specific information.
            //
            public static readonly string Name = "tcl_platform";

            //
            // NOTE: The various "well known" elements of the array.
            //
            public static readonly string ByteOrder = "byteOrder";
            public static readonly string CharacterSize = "characterSize"; // NOTE: In format ("min-max"). Not in Tcl.
            public static readonly string Debug = "debug";
            public static readonly string Version = "version";
            public static readonly string PatchLevel = "patchLevel";
            public static readonly string Engine = "engine"; // COMPAT: What engine are we really using? Not in Tcl.
            public static readonly string Host = "host"; // NOTE: Not in Tcl.
            public static readonly string Machine = "machine";
            public static readonly string OsName = "os";
            public static readonly string OsVersion = "osVersion";
            public static readonly string OsPatchLevel = "osPatchLevel";
            public static readonly string OsServicePack = "osServicePack";
            public static readonly string ProcessBits = "processBits"; // NOTE: Not in Tcl (32-bit or 64-bit, etc).
            public static readonly string PlatformName = "platform"; // COMPAT: Tcl.
            public static readonly string PointerSize = "pointerSize";
            public static readonly string Processors = "processors"; // NOTE: Not in Tcl.
            public static readonly string ProcessorAffinityMasks = "processorAffinityMasks"; // NOTE: Not in Tcl.
            public static readonly string Threaded = "threaded";
            public static readonly string Unicode = "unicode"; // NOTE: Not in Tcl.
            public static readonly string User = "user";
            public static readonly string WordSize = "wordSize";
            public static readonly string DirectorySeparator = "dirSeparator"; // NOTE: Not in Tcl.
            public static readonly string PathSeparator = "pathSeparator"; // NOTE: Not in Tcl, proposed by TIP #315.

            //
            // NOTE: The various "well known" values...
            //
            public static readonly string LittleEndianValue = "littleEndian"; // byteOrder
            public static readonly string BigEndianValue = "bigEndian";       // byteOrder
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        public static readonly string PlatformThreaded =
            FormatOps.VariableName(Platform.Name, Platform.Threaded);

        public static readonly string VersionName = "tcl_version";
        public static readonly string VersionValue = "8.4";       // NOTE: This is the version of Tcl we are emulating.
        public static readonly string PatchLevelName = "tcl_patchLevel";
        public static readonly string PatchLevelValue = "8.4.21"; // NOTE: This is the patch level of Tcl we are emulating.

        public static readonly string AutoExecutables = "auto_execs";
        public static readonly string AutoIndex = "auto_index";
        public static readonly string AutoNoExecute = "auto_noexec";
        public static readonly string AutoNoLoad = "auto_noload";
        public static readonly string AutoOldPath = "auto_oldpath";
        public static readonly string AutoPath = "auto_path";
        public static readonly string AutoSourcePath = "auto_source_path";

        public static readonly string Directory = "dir";

        public static readonly string ErrorCode = "errorCode";
        public static readonly string ErrorInfo = "errorInfo";

        public static readonly string ShellArgumentCount = "argc";
        public static readonly string ShellArguments = "argv";
        public static readonly string ShellArgument0 = "argv0";
        public static readonly string Arguments = "args";

        public static readonly string Environment = "env";

        public static readonly string Interactive = "tcl_interactive";
        public static readonly string InteractiveLoops = "tcl_interactiveLoops"; // NOTE: This does not exist in Tcl (Eagle only).

        public static readonly string Library = "tcl_library";
        public static readonly string LibraryPath = "tcl_libPath";
        public static readonly string PackagePath = "tcl_pkgPath";

        public static readonly string PrecisionName = "tcl_precision";
        public static readonly int PrecisionValue = 0; // the default precision value for doubles.

        public static readonly string RunCommandsFileName = "tcl_rcFileName";
        public static readonly string RunCommandsFileValue = "~/tclshrc.tcl";
        public static readonly string RunCommandsResourceName = "tcl_rcRsrcName"; // Mac OS Classic only.

        public static readonly string TraceCompile = "tcl_traceCompile";
        public static readonly string TraceExecute = "tcl_traceExec";

        public static readonly string NonWordCharacters = "tcl_nonwordchars";
        public static readonly string WordCharacters = "tcl_wordchars";

        public static readonly string Prompt1 = "tcl_prompt1";
        public static readonly string Prompt2 = "tcl_prompt2";

        public static readonly string PackageName = "Tcl";
        public static readonly Version PackageVersion = new Version(PatchLevelValue);
        public static readonly string PackageUnknown = "::tcl::tm::UnknownHandler ::tclPkgUnknown";
        public static readonly string BackgroundError = "bgerror";

#if false
        //
        // HACK: This is part of an ugly hack to add "tcl::mathfunc::*" and
        //       "tcl::mathop::*" support for [expr] functions and operators
        //       to Eagle, respectively.
        //
        public static readonly string MathFunctionNamespaceName = "tcl::mathfunc";
        public static readonly string MathOperatorNamespaceName = "tcl::mathop";
#endif

        public static readonly string NamespaceSeparator = "::";
        public static readonly string GlobalNamespace = NamespaceSeparator;
        public static readonly string GlobalNamespaceName = String.Empty;
        public static readonly string Unknown = GlobalNamespace + "unknown";

        public static readonly string BinPath = "bin";
        public static readonly string LibPath = "lib";

#if UNIX
        public static readonly string LibDataPath = "libdata";

        public static readonly string UserLocalPath = "/usr/local";
        public static readonly string UserLibPath = "/usr/lib";

        public static readonly string UserLocalLibPath =
            UserLocalPath + "/" + LibPath;

        public static readonly string UserLocalLibDataPath =
            UserLocalPath + "/" + LibDataPath;
#endif

        //
        // NOTE: These strings are recognized as doubles by the Tcl expression
        //       parser.
        //
        public static readonly string Infinity = "Inf";
        public static readonly string NaN = "NaN";
    }
}
