new: PL_atom_nchars

This commit is contained in:
Vitor Santos Costa 2010-06-18 09:14:45 +01:00
parent f4b86022d6
commit b74e38378f
2 changed files with 10 additions and 0 deletions

View File

@ -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);

View File

@ -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;