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/H/qly.h

132 lines
4.1 KiB
C
Raw Normal View History

2016-07-31 16:31:22 +01:00
2011-08-24 04:11:54 +01:00
/*************************************************************************
* *
* YAP Prolog *
* *
* Yap Prolog was developed at NCCUP - Universidade do Porto *
* *
* Copyright L.Damas, V. Santos Costa and Universidade do Porto 1985-- *
* *
**************************************************************************
* *
* File: qly.h *
* comments: quick saver/loader *
* *
* Last rev: $Date: 2011-08-29$,$Author: vsc $ *
* $Log: not supported by cvs2svn $ *
* *
*************************************************************************/
2016-07-31 16:31:22 +01:00
#define EXPORT_ATOM_TABLE_SIZE (16 * 4096)
#define EXPORT_FUNCTOR_TABLE_SIZE (16 * 4096)
2011-08-24 04:11:54 +01:00
#define EXPORT_OPCODE_TABLE_SIZE (4096)
#define EXPORT_PRED_ENTRY_TABLE_SIZE (128)
2011-08-31 21:59:30 +01:00
#define EXPORT_DBREF_TABLE_SIZE (128)
2011-08-24 04:11:54 +01:00
typedef struct export_atom_hash_entry_struct {
Atom val;
} export_atom_hash_entry_t;
typedef struct import_atom_hash_entry_struct {
Atom oval;
Atom val;
2016-07-31 16:31:22 +01:00
struct import_atom_hash_entry_struct *next;
2011-08-24 04:11:54 +01:00
} import_atom_hash_entry_t;
typedef struct export_functor_hash_entry_struct {
Functor val;
Atom name;
UInt arity;
} export_functor_hash_entry_t;
typedef struct import_functor_hash_entry_struct {
Functor val;
Functor oval;
2016-07-31 16:31:22 +01:00
struct import_functor_hash_entry_struct *next;
2011-08-24 04:11:54 +01:00
} import_functor_hash_entry_t;
typedef struct import_opcode_hash_entry_struct {
OPCODE val;
int id;
OPCODE oval;
2016-07-31 16:31:22 +01:00
struct import_opcode_hash_entry_struct *next;
2011-08-24 04:11:54 +01:00
} import_opcode_hash_entry_t;
typedef struct export_pred_entry_hash_entry_struct {
PredEntry *val;
union {
Functor f;
Atom a;
} u_af;
2011-08-24 04:11:54 +01:00
Atom module;
UInt arity;
} export_pred_entry_hash_entry_t;
typedef struct import_pred_entry_hash_entry_struct {
PredEntry *val;
PredEntry *oval;
2016-07-31 16:31:22 +01:00
struct import_pred_entry_hash_entry_struct *next;
2011-08-24 04:11:54 +01:00
} import_pred_entry_hash_entry_t;
2011-08-31 21:59:30 +01:00
typedef struct export_dbref_hash_entry_struct {
DBRef val;
UInt sz;
UInt refs;
} export_dbref_hash_entry_t;
typedef struct import_dbref_hash_entry_struct {
DBRef val;
DBRef oval;
int count;
2016-07-31 16:31:22 +01:00
struct import_dbref_hash_entry_struct *next;
2011-08-31 21:59:30 +01:00
} import_dbref_hash_entry_t;
2011-08-24 04:11:54 +01:00
typedef enum {
2011-08-28 01:23:14 +01:00
QLY_START_X = 0,
QLY_START_OPCODES = 1,
QLY_START_ATOMS = 2,
QLY_START_FUNCTORS = 3,
QLY_START_PRED_ENTRIES = 4,
2011-08-31 21:59:30 +01:00
QLY_START_DBREFS = 5,
QLY_START_MODULE = 6,
QLY_END_MODULES = 7,
QLY_START_LU_CLAUSE = 8,
QLY_END_LU_CLAUSES = 9,
QLY_NEW_OP = 10,
QLY_END_OPS = 11,
QLY_START_PREDICATE = 12,
QLY_END_PREDICATES = 13,
QLY_ATOM_WIDE = 14,
QLY_FAILCODE = 15,
2012-06-16 21:06:10 +01:00
QLY_ATOM = 16,
QLY_ATOM_BLOB = 17
2011-08-24 04:11:54 +01:00
} qlf_tag_t;
2016-07-31 16:31:22 +01:00
#define STATIC_PRED_FLAGS \
(SourcePredFlag | DynamicPredFlag | LogUpdatePredFlag | CompiledPredFlag | \
MultiFileFlag | TabledPredFlag | MegaClausePredFlag | CountPredFlag | \
ProfiledPredFlag | ThreadLocalPredFlag | AtomDBPredFlag | \
ModuleTransparentPredFlag | NumberDBPredFlag | MetaPredFlag | \
SyncPredFlag | BackCPredFlag)
#define EXTRA_PRED_FLAGS \
(QuasiQuotationPredFlag | NoTracePredFlag | NoSpyPredFlag)
#define SYSTEM_PRED_FLAGS \
(BackCPredFlag | UserCPredFlag | CArgsPredFlag | AsmPredFlag | CPredFlag | \
BinaryPredFlag)
#define CHECK(F) \
{ \
size_t r = (F); \
if (!r) \
return r; \
}
#define RCHECK(F) \
if (!(F)) { \
QLYR_ERROR(MISMATCH); \
return; \
}
2011-08-24 04:11:54 +01:00
2014-01-19 21:15:05 +00:00
#define AllocTempSpace() (HR)
2016-07-31 16:31:22 +01:00
#define EnoughTempSpace(sz) ((ASP - HR) * sizeof(CELL) > sz)