This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/PLStream/pl-codelist.h
2011-02-10 00:01:19 +00:00

34 lines
736 B
C

#ifndef PL_CODELIST_H
#define PL_CODELIST_H
static inline Word
INIT_SEQ_STRING(size_t n)
{
return (Word)YAP_OpenList(n);
}
static inline Word
EXTEND_SEQ_CODES(Word gstore, int c) {
return (Word)YAP_ExtendList((YAP_Term)gstore, YAP_MkIntTerm(c));
}
static inline Word
EXTEND_SEQ_CHARS(Word gstore, int c) {
return (Word)YAP_ExtendList((YAP_Term)gstore, codeToAtom(c));
}
static inline int
CLOSE_SEQ_STRING(Word gstore, Word lp, word arg2, word arg3, term_t l) {
if (arg2 == 0) {
if (!YAP_CloseList((YAP_Term)gstore, YAP_TermNil()))
return FALSE;
} else {
if (!YAP_CloseList((YAP_Term)gstore, YAP_GetFromSlot(arg2)))
return FALSE;
}
return YAP_Unify(YAP_GetFromSlot(arg3), (YAP_Term)lp);
}
#endif