Esempio n. 1
0
        public static void InitializeNoun(STS ssys, List<SemanticTypeDecl> decls, List<SemanticTypeStruct> structs)
        {
            // Reflective noun necessary for self-referential definition.
            SemanticTypeDecl decl = new SemanticTypeDecl() { OfTypeName = "Noun" };
            decl.AttributeValues.Add(new AttributeValue() { Name = "Name", Value = "Noun" });
            decls.Add(decl);

            SemanticTypeStruct sts = new SemanticTypeStruct() { DeclTypeName = "Noun" };
            sts.NativeTypes.Add(new Clifton.SemanticTypeSystem.NativeType() { Name = "Name", ImplementingType = "string" });
            structs.Add(sts);
        }
Esempio n. 2
0
 public void Update(STS sts)
 {
     Clear();
     PopulateTree(sts);
 }
Esempio n. 3
0
 protected void PopulateTree(STS sts)
 {
     sts.SemanticTypes.ForEach(t =>
         {
             object tn = TreeView.AddNode(null, t.Key, t);
             PopulateSTChildren(t.Value, tn);
         });
 }
Esempio n. 4
0
        static void Main()
        {
            Application.AddMessageFilter(new MouseWheelMessageFilter());

            try
            {
                SemanticTypeSystem = new STS();
                Skin = new Membrane(SemanticTypeSystem, null);
                Skin.Name = "Skin";
                // Receptors = new ReceptorsContainer();
                // Receptors.SemanticTypeSystem = SemanticTypeSystem;

                DropReceptor = new DropReceptor(Skin.ReceptorSystem);
                // Program.Skin.RegisterReceptor("DropReceptor", dr);

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                AppState = new StatePersistence();
                AppState.ReadState("appState.xml");																	// Load the last application state.
                MainForm = MycroParser.InstantiateFromFile<Form>("mainform.xml", null);
                Application.Run(MainForm);
                AppState.WriteState("appState.xml");																// Save the application state.
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                System.Diagnostics.Debugger.Break();
            }
        }
Esempio n. 5
0
        protected void InitializeSDRTests(Action initStructs)
        {
            // Initialize the Semantic Type System.
            ssys = new STS();

            // Initialize the Receptor System
            rsys = new ReceptorsContainer(ssys);

            // Initialize declaration and structure lists.
            decls = new List<SemanticTypeDecl>();
            structs = new List<SemanticTypeStruct>();

            // We must have a noun definition for now.
            Helpers.InitializeNoun(ssys, decls, structs);

            // We need this ST for query tests.
            SemanticTypeStruct sts = Helpers.CreateSemanticType("Query", false, decls, structs);
            Helpers.CreateNativeType(sts, "QueryText", "string", false);
            Helpers.CreateNativeType(sts, "Param0", "Object", false);

            // Initialize the Semantic Database Receptor
            sdr = new SemanticDatabase(rsys);
            sdr.DatabaseName = "test_semantic_database";
            sdr.Connect();

            // Create our semantic structure.
            initStructs();

            // Instantiate the runtime code-behind.
            ssys.Parse(decls, structs);
            string code = ssys.GenerateCode();
            System.Reflection.Assembly assy = Compiler.Compile(code);
            ssys.CompiledAssembly = assy;
        }