take advantage of compatibility with fixed atoms.
This commit is contained in:
@@ -30,94 +30,6 @@ typedef YAP_Atom Atom;
|
||||
|
||||
typedef uintptr_t PL_atomic_t; /* same a word */
|
||||
|
||||
|
||||
#ifdef __SWI_PROLOG__
|
||||
|
||||
/* just to make clear how it would look in SWI */
|
||||
|
||||
#define INIT_DEF(Type, Name, Size) \
|
||||
static void init_ ## Name (void) {} \
|
||||
static const Type Name[] {
|
||||
|
||||
#define ADD_DEF2(Atom, Type) \
|
||||
{ Atom, Type },
|
||||
#define ADD_DEF5(Atom, Type, Reverse, Arity, Ctx) \
|
||||
{ Atom, Type, Reverse, Arity, Ctx },
|
||||
\
|
||||
#define END_DEFS(Atom, F) \
|
||||
{ Atom, F }
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define INIT_DEF(Type, Name, Size) \
|
||||
static Type Name[Size]; \
|
||||
static void init_ ## Name (void) { \
|
||||
int i = 0;
|
||||
|
||||
#define ADD_DEF2(Atom, Type) \
|
||||
char_types[i].name = Atom; \
|
||||
char_types[i].test = Type; \
|
||||
i++;
|
||||
#define ADD_DEF5(Atom, Type, Reverse, Arity, Ctx) \
|
||||
char_types[i].name = Atom; \
|
||||
char_types[i].test = Type; \
|
||||
char_types[i].reverse = Reverse; \
|
||||
char_types[i].arity = Arity; \
|
||||
char_types[i].ctx_type = Ctx; \
|
||||
i++;
|
||||
#define END_DEFS(Atom, F) \
|
||||
char_types[i].name = Atom; \
|
||||
char_types[i].test = F; \
|
||||
}
|
||||
|
||||
#define ADD_ENCODING(Atom, Type) \
|
||||
encoding_names[i].code = Atom; \
|
||||
encoding_names[i].name = Type; \
|
||||
i++;
|
||||
#define END_ENCODINGS(Atom, F) \
|
||||
encoding_names[i].code = Atom; \
|
||||
encoding_names[i].name = F; \
|
||||
}
|
||||
|
||||
#define ADD_OPEN4_OPT(Atom, Type) \
|
||||
open4_options[i].name = Atom; \
|
||||
open4_options[i].type = Type; \
|
||||
i++;
|
||||
#define END_OPEN4_DEFS(Atom, F) \
|
||||
open4_options[i].name = Atom; \
|
||||
open4_options[i].type = F; \
|
||||
}
|
||||
|
||||
#define ADD_CLOSE2_OPT(Atom, Type) \
|
||||
close2_options[i].name = Atom; \
|
||||
close2_options[i].type = Type; \
|
||||
i++;
|
||||
#define END_CLOSE2_DEFS(Atom, F) \
|
||||
close2_options[i].name = Atom; \
|
||||
close2_options[i].type = F; \
|
||||
}
|
||||
|
||||
#define ADD_SPROP(F1, F2) \
|
||||
sprop_list[i].functor = F1; \
|
||||
sprop_list[i].function = F2; \
|
||||
i++;
|
||||
#define END_SPROP_DEFS(F1, F2) \
|
||||
sprop_list[i].functor = F1; \
|
||||
sprop_list[i].function = F2; \
|
||||
}
|
||||
|
||||
#define ADD_STDSTREAM(Atom) \
|
||||
standardStreams[i] = Atom; \
|
||||
i++;
|
||||
#define END_STDSTREAMS(Atom) \
|
||||
standardStreams[i] = Atom; \
|
||||
}
|
||||
|
||||
|
||||
#define MK_ATOM(X) ((atom_t)YAP_LookupAtom(X))
|
||||
#define MKFUNCTOR(X,Y) ((functor_t)YAP_MkFunctor((YAP_Atom)(X),Y))
|
||||
|
||||
/*** memory allocation stuff: SWI wraps around malloc */
|
||||
|
||||
#define allocHeap(X) YAP_AllocSpaceFromYap(X)
|
||||
|
Reference in New Issue
Block a user