def _pygp_to_structure(term): v1 = pygprolog.pygp_Mk_Variable() v2 = pygprolog.pygp_Mk_Variable() pygprolog.pygp_Builtin_Functor(term, v1, v2) functor = pygprolog.pygp_Rd_String(v1) arity = pygprolog.pygp_Rd_Integer(v2) args = [] for i in range(1, arity+1): v = pygprolog.pygp_Mk_Variable() pygprolog.pygp_Builtin_Arg(pygprolog.pygp_Mk_Integer(i), term, v) args.append(_read_pygp(v)) # global global_context return Structure(c_functor(functor, arity), args)
def _pygp_atm_to_symbol(term): # global global_context return c_symbol(pygprolog.pygp_Rd_String(term))
def _pygp_to_const(term): # global global_context return c_const(pygprolog.pygp_Rd_String(term))