Exemplo n.º 1
0
        public unsafe string Dump(Guid g_symbols, Guid g_structures, Guid nodeID)
        {
            Defs      defs = CreateDefs(g_symbols, g_structures);
            TreeNode *node = (TreeNode *)nodes[nodeID];

            return(Dump(defs, node));
        }
Exemplo n.º 2
0
        public unsafe Guid ParseSemtrex(Guid g_symbols, Guid g_structures, string expression)
        {
            Defs      defs   = CreateDefs(g_symbols, g_structures);
            TreeNode *node   = parseSemtrex(&defs, expression);
            Guid      nodeID = RegisterNode(node);

            return(nodeID);
        }
Exemplo n.º 3
0
        /* create a new tree based on the matched elements from a semtrex match
         *
         * @param[in] defs definitions of the semantic context
         * @param[in] match a match from a call to _t_matchr
         * @param[in] parent the parent tree to add the embodiment into
         *
         */
        public unsafe Guid Embody(Guid g_symbols, Guid g_structures, Guid matchID, Guid semtrexID)
        {
            Defs      defs       = CreateDefs(g_symbols, g_structures);
            TreeNode *match      = GetNode(matchID);
            TreeNode *semtrex    = GetNode(semtrexID);
            TreeNode *resultTree = _t_embody_from_match(&defs, match, semtrex);

            return(RegisterNode(resultTree));
        }
Exemplo n.º 4
0
        protected unsafe Defs CreateDefs(Guid g_symbols, Guid g_structures)
        {
            Defs defs = new Defs()
            {
                structures = (TreeNode *)nodes[g_structures],
                symbols    = (TreeNode *)nodes[g_symbols],
                processes  = (TreeNode *)0,
                scapes     = (TreeNode *)0
            };

            return(defs);
        }
Exemplo n.º 5
0
        public unsafe string CreateVisualTree(Guid g_symbols, Guid g_structures, Guid g_tree)
        {
            Defs      defs = CreateDefs(g_symbols, g_structures);
            TreeNode *tree = GetNode(g_tree);
            string    ret  = String.Empty;

            fixed(char *buf = new char[50000])
            {
                _t2json(&defs, tree, -1, buf);
                ret = Marshal.PtrToStringAnsi((IntPtr)buf);
            }

            return(ret);
        }
Exemplo n.º 6
0
        protected unsafe string Dump(Defs defs, TreeNode *node)
        {
            string ret = String.Empty;

            try
            {
                fixed(char *buf = new char[10000])
                {
                    __t_dump(&defs, node, 0, buf);
                    ret = Marshal.PtrToStringAnsi((IntPtr)buf);
                }
            }
            catch (Exception ex)
            {
                // TODO: Log message
                System.Diagnostics.Debug.WriteLine(ex.Message);
                System.Diagnostics.Debugger.Break();
            }

            return(ret);
        }
Exemplo n.º 7
0
		protected unsafe string Dump(Defs defs, TreeNode* node)
		{
			string ret = String.Empty;

			try
			{
				fixed (char* buf = new char[10000])
				{
					__t_dump(&defs, node, 0, buf);
					ret = Marshal.PtrToStringAnsi((IntPtr)buf);
				}
			}
			catch (Exception ex)
			{
				// TODO: Log message
				System.Diagnostics.Debug.WriteLine(ex.Message);
				System.Diagnostics.Debugger.Break();
			}

			return ret;
		}
Exemplo n.º 8
0
		protected unsafe Defs CreateDefs(Guid g_symbols, Guid g_structures)
		{
			Defs defs = new Defs()
			{
				structures = (TreeNode*)nodes[g_structures],
				symbols = (TreeNode*)nodes[g_symbols],
				processes = (TreeNode*)0,
				scapes = (TreeNode*)0
			};

			return defs;
		}
Exemplo n.º 9
0
		extern static unsafe void _t2json(Defs* d, TreeNode* tree, int indent, char* buf);
Exemplo n.º 10
0
		extern static unsafe TreeNode* _t_embody_from_match(Defs* d, TreeNode* matchResult, TreeNode* semtrex);
Exemplo n.º 11
0
		extern static unsafe TreeNode* parseSemtrex(Defs* d, string stx);
Exemplo n.º 12
0
		// [return: MarshalAs(UnmanagedType.LPStr)]
		extern static unsafe void __t_dump(Defs* defs, TreeNode* t, int level, char* buf);
Exemplo n.º 13
0
        public unsafe string DumpSymbols(Guid g_symbols, Guid g_structures)
        {
            Defs defs = CreateDefs(g_symbols, g_structures);

            return(Dump(defs, defs.symbols));
        }