diff --git a/include/SWI-Prolog.h b/include/SWI-Prolog.h index 54f863bd1..189bee1fe 100755 --- a/include/SWI-Prolog.h +++ b/include/SWI-Prolog.h @@ -362,6 +362,7 @@ typedef struct PL_blob_t extern X_API PL_agc_hook_t PL_agc_hook(PL_agc_hook_t); extern X_API char* PL_atom_chars(atom_t); +extern X_API char* PL_atom_nchars(atom_t, size_t *); extern X_API term_t PL_copy_term_ref(term_t); extern X_API term_t PL_new_term_ref(void); extern X_API term_t PL_new_term_refs(int); diff --git a/library/yap2swi/yap2swi.c b/library/yap2swi/yap2swi.c index 76dea181d..a71b6fa5d 100755 --- a/library/yap2swi/yap2swi.c +++ b/library/yap2swi/yap2swi.c @@ -265,6 +265,15 @@ X_API char* PL_atom_chars(atom_t a) /* SAM check type */ return RepAtom(SWIAtomToAtom(a))->StrOfAE; } +/* SWI: char* PL_atom_chars(atom_t atom) + YAP: char* AtomName(Atom) */ +X_API char* PL_atom_nchars(atom_t a, size_t *len) /* SAM check type */ +{ + char *s = RepAtom(SWIAtomToAtom(a))->StrOfAE; + *len = strlen(s); + return s; +} + X_API int PL_chars_to_term(const char *s, term_t term) { YAP_Term t,error;