Пример #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));
        }
Пример #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);
        }
Пример #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));
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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;
		}
Пример #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;
		}
Пример #9
0
		extern static unsafe void _t2json(Defs* d, TreeNode* tree, int indent, char* buf);
Пример #10
0
		extern static unsafe TreeNode* _t_embody_from_match(Defs* d, TreeNode* matchResult, TreeNode* semtrex);
Пример #11
0
		extern static unsafe TreeNode* parseSemtrex(Defs* d, string stx);
Пример #12
0
		// [return: MarshalAs(UnmanagedType.LPStr)]
		extern static unsafe void __t_dump(Defs* defs, TreeNode* t, int level, char* buf);
Пример #13
0
        public unsafe string DumpSymbols(Guid g_symbols, Guid g_structures)
        {
            Defs defs = CreateDefs(g_symbols, g_structures);

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