Exemple #1
0
        //
        // This is used when we encounter a #line preprocessing directive during parsing
        // to register additional source file names
        //
        public SourceFile LookupFile(CompilationSourceFile comp_unit, string name)
        {
            if (all_source_files == null)
            {
                all_source_files = new Dictionary <string, SourceFile> ();
                foreach (var source in SourceFiles)
                {
                    all_source_files[source.FullPathName] = source;
                }
            }

            string path;

            if (!Path.IsPathRooted(name))
            {
                string root = Path.GetDirectoryName(comp_unit.SourceFile.FullPathName);
                path = Path.Combine(root, name);
            }
            else
            {
                path = name;
            }

            SourceFile retval;

            if (all_source_files.TryGetValue(path, out retval))
            {
                return(retval);
            }

            retval = new SourceFile(name, path, all_source_files.Count + 1);
            Location.AddFile(retval);
            all_source_files.Add(path, retval);
            return(retval);
        }
Exemple #2
0
		//
		// This is used when we encounter a #line preprocessing directive during parsing
		// to register additional source file names
		//
		public SourceFile LookupFile (CompilationSourceFile comp_unit, string name)
		{
			if (all_source_files == null) {
				all_source_files = new Dictionary<string, SourceFile> ();
				foreach (var source in SourceFiles)
					all_source_files[source.FullPathName] = source;
			}

			string path;
			if (!Path.IsPathRooted (name)) {
				var loc = comp_unit.SourceFile;
				string root = Path.GetDirectoryName (loc.FullPathName);
				path = Path.GetFullPath (Path.Combine (root, name));
				var dir = Path.GetDirectoryName (loc.Name);
				if (!string.IsNullOrEmpty (dir))
					name = Path.Combine (dir, name);
			} else
				path = name;

			SourceFile retval;
			if (all_source_files.TryGetValue (path, out retval))
				return retval;

			retval = new SourceFile (name, path, all_source_files.Count + 1);
			Location.AddFile (retval);
			all_source_files.Add (path, retval);
			return retval;
		}
Exemple #3
0
        static void Reset()
        {
            CompilerCallableEntryPoint.PartialReset();

            //
            // PartialReset should not reset the core types, this is very redundant.
            //
            if (!TypeManager.InitCoreTypes())
            {
                throw new Exception("Failed to InitCoreTypes");
            }
            TypeManager.InitOptionalCoreTypes();

            Location.AddFile("{interactive}");
            Location.Initialize();

            current_debug_name = "interactive" + (count++) + ".dll";
            if (Environment.GetEnvironmentVariable("SAVE") != null)
            {
                CodeGen.Init(current_debug_name, current_debug_name, false);
            }
            else
            {
                CodeGen.InitDynamic(current_debug_name);
            }
        }
Exemple #4
0
        static void Reset()
        {
            CompilerCallableEntryPoint.PartialReset();

            // Workaround for API limitation where full message printer cannot be passed
            ReportPrinter printer = MessageOutput == Console.Out || MessageOutput == Console.Error ?
                                    new ConsoleReportPrinter(MessageOutput) :
                                    new StreamReportPrinter(MessageOutput);

            ctx = new CompilerContext(new Report(printer));
            RootContext.ToplevelTypes = new ModuleContainer(ctx, true);

            //
            // PartialReset should not reset the core types, this is very redundant.
            //
            if (!TypeManager.InitCoreTypes(ctx))
            {
                throw new Exception("Failed to InitCoreTypes");
            }
            TypeManager.InitOptionalCoreTypes(ctx);

            Location.AddFile(null, "{interactive}");
            Location.Initialize();

            current_debug_name = "interactive" + (count++) + ".dll";
            if (Environment.GetEnvironmentVariable("SAVE") != null)
            {
                CodeGen.Init(current_debug_name, current_debug_name, false, ctx);
            }
            else
            {
                CodeGen.InitDynamic(ctx, current_debug_name);
            }
        }
Exemple #5
0
        static void Reset()
        {
            CompilerCallableEntryPoint.PartialReset();

            Location.AddFile(null, "{interactive}");
            Location.Initialize();
        }
        static void Reset()
        {
            CompilerCallableEntryPoint.PartialReset();

            Location.AddFile(null, "{interactive}");
            Location.Initialize();

            current_debug_name = "interactive" + (count++) + ".dll";
        }
Exemple #7
0
		void AddSourceFile (string f)
		{
			Location.AddFile (report, f);
		}