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)); }
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); }
/* 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)); }
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); }
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); }
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); }
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; }
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; }
extern static unsafe void _t2json(Defs* d, TreeNode* tree, int indent, char* buf);
extern static unsafe TreeNode* _t_embody_from_match(Defs* d, TreeNode* matchResult, TreeNode* semtrex);
extern static unsafe TreeNode* parseSemtrex(Defs* d, string stx);
// [return: MarshalAs(UnmanagedType.LPStr)] extern static unsafe void __t_dump(Defs* defs, TreeNode* t, int level, char* buf);
public unsafe string DumpSymbols(Guid g_symbols, Guid g_structures) { Defs defs = CreateDefs(g_symbols, g_structures); return(Dump(defs, defs.symbols)); }