예제 #1
0
파일: AutoArch.cs 프로젝트: knoxaramav2/KCC
        private void DetectSystem()
        {
            var si = new SYSTEM_INFO();

            GetNativeSystemInfo(ref si);

            switch (si.wProcessorArchitecture)
            {
            case PROC_ARCH_INTEL:
                Arch          = ProcessorArchitecture.X86;
                MAX_BUS_WIDTH = 4;
                break;

            case PROC_ARCH_IA64:
                Arch          = ProcessorArchitecture.IA64;
                MAX_BUS_WIDTH = 8;
                break;

            case PROC_ARCH_AMD64:
                Arch          = ProcessorArchitecture.Amd64;
                MAX_BUS_WIDTH = 8;
                break;

            case PROC_ARCH_ARM:
                Arch          = ProcessorArchitecture.Arm;
                MAX_BUS_WIDTH = 8;
                break;

            default:
                ErrorReporter.GetInstance().Add(
                    $"Unrecognized CPU family: {si.wProcessorArchitecture}",
                    ErrorCode.UnrecognizedInstructionFamily);
                break;
            }
        }
예제 #2
0
파일: PageInfo.cs 프로젝트: knoxaramav2/KCC
        public void AddDependency(string uri)
        {
            if (string.IsNullOrEmpty(uri))
            {
                return;
            }

            if (!DependencyList.Contains(uri))
            {
                DependencyList.Add(uri);
            }

            ErrorReporter.GetInstance().Add("Import redefinition of " + uri + " in " + Uri, ErrorCode.ImportRedefine);
        }
예제 #3
0
        public void AddMacro(string alias, string symbol)
        {
            var errorReporter = ErrorReporter.GetInstance();

            foreach (var macro in Macros)
            {
                if (macro.Alias != alias)
                {
                    continue;
                }
                errorReporter.Add("Macro " + alias + "already defined", ErrorCode.MacroRedefine);
                return;
            }

            Macros.Add(new Macro(alias, symbol));
        }
예제 #4
0
파일: AutoArch.cs 프로젝트: knoxaramav2/KCC
 private void DetectPlatform()
 {
     if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
     {
         OS = OS.Windows;
     }
     else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
     {
         OS = OS.Linux;
     }
     else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
     {
         OS = OS.OSX;
         ErrorReporter.GetInstance().Add("MacOS has no planned support", ErrorCode.UnsupportedOS);
     }
     else
     {
         OS = OS.NA;
         ErrorReporter.GetInstance().Add("Operating system can not be recognized: " +
                                         $"{RuntimeInformation.OSDescription}", ErrorCode.UnrecognizedOS);
     }
 }
예제 #5
0
파일: PageInfo.cs 프로젝트: knoxaramav2/KCC
        public PageInfo LoadFile(string path)
        {
            if (path.Length == 0)
            {
                return(null);
            }

            PageInfo page = null;

            try
            {
                page = new PageInfo(path);

                _pages.Add(page);
            }
            catch (FileNotFoundException e)
            {
                ErrorReporter.GetInstance().Add(
                    e.ToString(), ErrorCode.FileNotFound);
            }

            return(page);
        }