Esempio n. 1
0
        public static Knowledge Initialize(Cdn.Network network)
        {
            if (s_instance == null || s_instance.Network != network)
            {
                s_instance = new Knowledge(network);
                s_instance.Init();
            }

            return(s_instance);
        }
Esempio n. 2
0
        public Validator(Cdn.Network network)
        {
            d_network = network;

            InitRand();

            if (!Options.Instance.PrintCompileSource)
            {
                RunCodyn();
            }
        }
Esempio n. 3
0
        public unsafe bool Load(Cdn.Network network, Cdn.Node parent)
        {
            IntPtr error   = IntPtr.Zero;
            bool   raw_ret = cdn_import_load(Handle, network == null ? IntPtr.Zero : network.Handle, parent == null ? IntPtr.Zero : parent.Handle, out error);
            bool   ret     = raw_ret;

            if (error != IntPtr.Zero)
            {
                throw new GLib.GException(error);
            }
            return(ret);
        }
Esempio n. 4
0
 public Layout(Cdn.Network network) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(Layout))
     {
         ArrayList vals  = new ArrayList();
         ArrayList names = new ArrayList();
         if (network != null)
         {
             names.Add("network");
             vals.Add(new GLib.Value(network));
         }
         CreateNativeObject((string[])names.ToArray(typeof(string)), (GLib.Value[])vals.ToArray(typeof(GLib.Value)));
         return;
     }
     Raw = cdn_layout_new(network == null ? IntPtr.Zero : network.Handle);
 }
Esempio n. 5
0
        public unsafe Import(Cdn.Network network, Cdn.Node parent, string id, string path) : base(IntPtr.Zero)
        {
            if (GetType() != typeof(Import))
            {
                throw new InvalidOperationException("Can't override this constructor.");
            }
            IntPtr native_id   = GLib.Marshaller.StringToPtrGStrdup(id);
            IntPtr native_path = GLib.Marshaller.StringToPtrGStrdup(path);
            IntPtr error       = IntPtr.Zero;

            Raw = cdn_import_new_from_path(network == null ? IntPtr.Zero : network.Handle, parent == null ? IntPtr.Zero : parent.Handle, native_id, native_path, out error);
            GLib.Marshaller.Free(native_id);
            GLib.Marshaller.Free(native_path);
            if (error != IntPtr.Zero)
            {
                throw new GLib.GException(error);
            }
        }
Esempio n. 6
0
 public NetworkSerializer(Cdn.Network network, Cdn.Node root) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(NetworkSerializer))
     {
         ArrayList vals  = new ArrayList();
         ArrayList names = new ArrayList();
         if (network != null)
         {
             names.Add("network");
             vals.Add(new GLib.Value(network));
         }
         if (root != null)
         {
             names.Add("root");
             vals.Add(new GLib.Value(root));
         }
         CreateNativeObject((string[])names.ToArray(typeof(string)), (GLib.Value[])vals.ToArray(typeof(GLib.Value)));
         return;
     }
     Raw = cdn_network_serializer_new(network == null ? IntPtr.Zero : network.Handle, root == null ? IntPtr.Zero : root.Handle);
 }
Esempio n. 7
0
 public Monitor(Cdn.Network network, Cdn.Variable property) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(Monitor))
     {
         ArrayList vals  = new ArrayList();
         ArrayList names = new ArrayList();
         if (network != null)
         {
             names.Add("network");
             vals.Add(new GLib.Value(network));
         }
         if (property != null)
         {
             names.Add("property");
             vals.Add(new GLib.Value(property));
         }
         CreateNativeObject((string[])names.ToArray(typeof(string)), (GLib.Value[])vals.ToArray(typeof(GLib.Value)));
         return;
     }
     Raw = cdn_monitor_new(network == null ? IntPtr.Zero : network.Handle, property == null ? IntPtr.Zero : property.Handle);
 }
Esempio n. 8
0
        private Cdn.Variable FindSame(Cdn.Network nout, Cdn.Variable v)
        {
            var parent = v.Object;

            Stack <Cdn.Object> parents = new Stack <Object>();

            while (parent != null && parent.Parent != null)
            {
                parents.Push(parent);
                parent = parent.Parent;
            }

            Cdn.Object outParent = nout;

            while (outParent != null && parents.Count > 0)
            {
                parent = parents.Pop();

                var node = outParent as Cdn.Node;

                if (node != null)
                {
                    outParent = node.GetChild(parent.Id);
                }
                else
                {
                    outParent = null;
                }
            }

            if (outParent != null)
            {
                return(outParent.Variable(v.Name));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 9
0
        private Cdn.Network LoadNetwork(string filename)
        {
            Cdn.Network n;

            try
            {
                n = new Cdn.Network(filename);
            }
            catch (GLib.GException e)
            {
                throw new Exception("Failed to load network: {0}", e.Message);
            }

            CompileError error = new CompileError();

            if (!n.Compile(null, error))
            {
                throw new Exception("Failed to compile network: {0}", error.FormattedString);
            }

            return(n);
        }
Esempio n. 10
0
        private void LoadNetwork()
        {
            if (Options.Instance.Validate)
            {
                Cdn.InstructionRand.UseStreams = true;
                Cdn.Function.RandAsArgument    = true;
            }

            try
            {
                d_network = new Cdn.Network(d_filename);
            }
            catch (GLib.GException e)
            {
                throw new Exception("Failed to load network: {0}", e.Message);
            }

            CompileError error = new CompileError();

            if (!d_network.Compile(null, error))
            {
                throw new Exception("Failed to compile network: {0}", error.FormattedString);
            }
        }
Esempio n. 11
0
 public string[] Bind(Cdn.Network ninp, Cdn.Network nout, IEnumerable <Binder.Binding> bindings)
 {
     return(null);
 }
Esempio n. 12
0
 protected Network(Cdn.Network obj) : base(obj)
 {
 }
Esempio n. 13
0
 public Knowledge(Cdn.Network network)
 {
     d_network = network;
 }