Exemple #1
0
        public GamaGlobalContext(string name)
        {
            ModuleName = $"{ name }.mod";

            ErrorList = new GamaErrorCollection();

            Module  = LLVMModuleRef.CreateWithName(ModuleName);
            Context = Module.Context;

            Root       = new GamaNamespace("[root]", this);
            Namespaces = new List <GamaNamespace>();

            ImportedFiles = new List <string>();

            // I know this is 'unsafe', but these methods are not implemeted to their OOP counterparts yet
            // So I am stuck with this for now
            unsafe
            {
                LLVM.SetDataLayout(Module, "e-m:w-i64:64-f80:128-n8:16:32:64-S128".GetSbytePtr());
                if (Environment.OSVersion.Platform == PlatformID.Unix)
                {
                    LLVM.SetTarget(Module, "x86_64-pc-linux-gnu".GetSbytePtr());
                }
                else
                {
                    LLVM.SetTarget(Module, "x86_64-pc-windows".GetSbytePtr());
                }
            }
        }
 public SourcePreprocesssorVisitor()
 {
     Defines = new Dictionary <string, string>();
     Errors  = new GamaErrorCollection();
 }