BEW CONSTANTS.
This commit is contained in:
parent
01a720389e
commit
6d507ff49f
11
C/init.c
11
C/init.c
@ -1071,16 +1071,19 @@ InitLogDBErasedMarker(void)
|
||||
static void
|
||||
InitSWIAtoms(void)
|
||||
{
|
||||
/* extern atom_t ATOM_;
|
||||
/* extern atom_t ATOM_;FUNV
|
||||
|
||||
int j=0;
|
||||
MaxAtomTranslations = 2*N_SWI_ATOMS ;
|
||||
SWI_Atoms = (Atom *)malloc(sizeof(Atom)*MaxAtomTranslations);
|
||||
SWI_Functors = (Functor *)malloc(sizeof(Functor)*2*N_SWI_ATOMS);
|
||||
#include "iswiatoms.h"
|
||||
#include "i
|
||||
|
||||
|
||||
atoms.h"
|
||||
Yap_InitSWIHash();
|
||||
ATOM_ = PL_new_atom("");
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1263,7 +1266,7 @@ InitHandles(int wid) {
|
||||
|
||||
REMOTE_CurSlot(wid) = 1;
|
||||
REMOTE_NSlots(wid) = initial_slots;
|
||||
handles = malloc(initial_slots * sizeof(CELL));
|
||||
handles = calloc(initial_slots , sizeof(CELL));
|
||||
|
||||
if(handles == NULL) {
|
||||
Yap_Error(SYSTEM_ERROR, 0 /* TermNil */, "No space for handles at " __FILE__ " : %d", __LINE__);
|
||||
|
81
H/blobs.h
Normal file
81
H/blobs.h
Normal file
@ -0,0 +1,81 @@
|
||||
//
|
||||
// blobs.h
|
||||
// yap
|
||||
//
|
||||
// Created by VITOR SANTOS COSTA on 09/05/15.
|
||||
// Copyright (c) 2015 VITOR SANTOS COSTA. All rights reserved.
|
||||
//
|
||||
|
||||
// based on the SWI Blob implementation, an extension of atoms for SWI-Prolog
|
||||
|
||||
#ifndef BLOBS_H
|
||||
#define BLOBS_H
|
||||
|
||||
#ifndef X_API
|
||||
#if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(PL_KERNEL)
|
||||
#define X_API __declspec(dllexport)
|
||||
#else
|
||||
#define X_API
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*******************************
|
||||
* BLOBS *
|
||||
*******************************/
|
||||
|
||||
#define YAP_BLOB_MAGIC_B 0x75293a00 /* Magic to validate a blob-type */
|
||||
#define PL_BLOB_VERSION (YAP_BLOB_MAGIC_B|PL_BLOB_VERSION)
|
||||
|
||||
#define PL_BLOB_UNIQUE 0x01 /* Blob content is unique */
|
||||
#define PL_BLOB_TEXT 0x02 /* blob contains text */
|
||||
#define PL_BLOB_NOCOPY 0x04 /* do not copy the data */
|
||||
#define PL_BLOB_WCHAR 0x08 /* wide character string */
|
||||
|
||||
typedef struct YAP_blob_t
|
||||
{ uintptr_t magic; /* YAP_BLOB_MAGIC */
|
||||
uintptr_t flags; /* YAP_BLOB_* */
|
||||
char * name; /* name of the type */
|
||||
int (*release)(Atom a);
|
||||
int (*compare)(Atom a, Atom b);
|
||||
#ifdef SIO_MAGIC
|
||||
int (*write)(FILE *s, Atom a, int flags);
|
||||
#else
|
||||
int (*write)(void *s, Atom a, int flags);
|
||||
#endif
|
||||
void (*acquire)(Atom a);
|
||||
#ifdef SIO_MAGIC
|
||||
int (*save)(Atom a, FILE *s);
|
||||
Atom (*load)(FILE *s);
|
||||
#else
|
||||
int (*save)(Atom a, void*);
|
||||
Atom (*load)(void *s);
|
||||
#endif
|
||||
/* private */
|
||||
void * reserved[10]; /* for future extension */
|
||||
int registered; /* Already registered? */
|
||||
int rank; /* Rank for ordering atoms */
|
||||
struct YAP_blob_t * next; /* next in registered type-chain */
|
||||
Atom atom_name; /* Name as atom */
|
||||
} blob_type_t;
|
||||
|
||||
int Yap_write_blob(AtomEntry *ref, FILE *stream);
|
||||
char * Yap_blob_to_string(AtomEntry *ref, const char *s, size_t sz);
|
||||
X_API bool YAP_is_blob(YAP_Term t, blob_type_t **type);
|
||||
X_API bool YAP_unify_blob(YAP_Term *t, void *blob, size_t len,
|
||||
blob_type_t *type);
|
||||
X_API bool YAP_put_blob(YAP_Term *t, void *blob, size_t len,
|
||||
blob_type_t *type);
|
||||
X_API bool YAP_get_blob(YAP_Term t, void **blob, size_t *len,
|
||||
blob_type_t **type);
|
||||
|
||||
X_API void* YAP_blob_data(Atom a,
|
||||
size_t *len,
|
||||
struct YAP_blob_t **type);
|
||||
|
||||
X_API void YAP_register_blob_type(blob_type_t *type);
|
||||
X_API blob_type_t* YAP_find_blob_type(const char* name);
|
||||
//YAP_blob_type_t* YAP_find_blob_type(Atom at);
|
||||
X_API bool YAP_unregister_blob_type(blob_type_t *type);
|
||||
|
||||
|
||||
#endif
|
@ -71,6 +71,9 @@
|
||||
#endif /* THREADS */
|
||||
|
||||
#define GLOBAL_Stream Yap_global->Stream_
|
||||
#if defined(THREADS)
|
||||
#define GLOBAL_StreamDescLock Yap_global->StreamDescLock_
|
||||
#endif
|
||||
|
||||
#define GLOBAL_argv Yap_global->argv_
|
||||
#define GLOBAL_argc Yap_global->argc_
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
/* This file, dhstruct.h, was generated automatically by "yap -L misc/buildheap"
|
||||
please do not update, update misc/HEAPFIELDS instead */
|
||||
|
||||
/* This file, dhstruct.h , was generated automatically by "yap -L misc/buildheap"
|
||||
please do not update, update misc/HEAPFIELDS instead */
|
||||
|
||||
|
||||
|
||||
@ -179,6 +179,7 @@
|
||||
#endif
|
||||
#define PredGoalExpansion Yap_heap_regs->pred_goal_expansion
|
||||
#define PredMetaCall Yap_heap_regs->pred_meta_call
|
||||
#define PredTraceMetaCall Yap_heap_regs->pred_trace_meta_call
|
||||
#define PredDollarCatch Yap_heap_regs->pred_dollar_catch
|
||||
#define PredRecordedWithKey Yap_heap_regs->pred_recorded_with_key
|
||||
#define PredLogUpdClause Yap_heap_regs->pred_log_upd_clause
|
||||
|
@ -153,8 +153,12 @@
|
||||
#define REMOTE_UncaughtThrow(wid) REMOTE(wid)->UncaughtThrow_
|
||||
#define LOCAL_DoingUndefp LOCAL->DoingUndefp_
|
||||
#define REMOTE_DoingUndefp(wid) REMOTE(wid)->DoingUndefp_
|
||||
#define LOCAL_StartLine LOCAL->StartLine_
|
||||
#define REMOTE_StartLine(wid) REMOTE(wid)->StartLine_
|
||||
#define LOCAL_StartCharCount LOCAL->StartCharCount_
|
||||
#define REMOTE_StartCharCount(wid) REMOTE(wid)->StartCharCount_
|
||||
#define LOCAL_StartLineCount LOCAL->StartLineCount_
|
||||
#define REMOTE_StartLineCount(wid) REMOTE(wid)->StartLineCount_
|
||||
#define LOCAL_StartLinePos LOCAL->StartLinePos_
|
||||
#define REMOTE_StartLinePos(wid) REMOTE(wid)->StartLinePos_
|
||||
#define LOCAL_ScratchPad LOCAL->ScratchPad_
|
||||
#define REMOTE_ScratchPad(wid) REMOTE(wid)->ScratchPad_
|
||||
#ifdef COROUTINING
|
||||
|
@ -71,6 +71,9 @@ typedef struct global_data {
|
||||
#endif /* THREADS */
|
||||
|
||||
struct stream_desc* Stream_;
|
||||
#if defined(THREADS)
|
||||
lockvar StreamDescLock_;
|
||||
#endif
|
||||
|
||||
char** argv_;
|
||||
int argc_;
|
||||
|
@ -85,7 +85,9 @@ typedef struct worker_local {
|
||||
yamop* ProfEnd_;
|
||||
int UncaughtThrow_;
|
||||
int DoingUndefp_;
|
||||
Int StartLine_;
|
||||
Int StartCharCount_;
|
||||
Int StartLineCount_;
|
||||
Int StartLinePos_;
|
||||
scratch_block ScratchPad_;
|
||||
#ifdef COROUTINING
|
||||
Term WokenGoals_;
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
/* This file, hstruct.h, was generated automatically by "yap -L misc/buildheap"
|
||||
please do not update, update misc/HEAPFIELDS instead */
|
||||
|
||||
/* This file, hstruct.h , was generated automatically by "yap -L misc/buildheap"
|
||||
please do not update, update misc/HEAPFIELDS instead */
|
||||
|
||||
|
||||
|
||||
@ -179,6 +179,7 @@
|
||||
#endif
|
||||
struct pred_entry *pred_goal_expansion;
|
||||
struct pred_entry *pred_meta_call;
|
||||
struct pred_entry *pred_trace_meta_call;
|
||||
struct pred_entry *pred_dollar_catch;
|
||||
struct pred_entry *pred_recorded_with_key;
|
||||
struct pred_entry *pred_log_upd_clause;
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
/* This file, iatoms.h, was generated automatically by "yap -L misc/buildatoms"
|
||||
|
||||
/* This file, iatoms.h , was generated automatically by "yap -L misc/buildatoms"
|
||||
please do not update, update misc/ATOMS instead */
|
||||
|
||||
Atom3Dots = Yap_LookupAtom("...");
|
||||
@ -81,6 +81,7 @@
|
||||
AtomDBTerm = Yap_LookupAtom("db_term");
|
||||
AtomDBref = Yap_FullLookupAtom("$dbref");
|
||||
AtomDInteger = Yap_FullLookupAtom("$integer");
|
||||
AtomDebugMeta = Yap_FullLookupAtom("$debug_meta");
|
||||
AtomDebuggerInput = Yap_LookupAtom("debugger_input");
|
||||
AtomDec10 = Yap_LookupAtom("dec10");
|
||||
AtomDefault = Yap_LookupAtom("default");
|
||||
@ -354,6 +355,7 @@
|
||||
AtomTimeoutError = Yap_LookupAtom("timeout_error");
|
||||
AtomTopLevelGoal = Yap_FullLookupAtom("$top_level_goal");
|
||||
AtomTopThreadGoal = Yap_FullLookupAtom("$top_thread_goal");
|
||||
AtomTraceMetaCall = Yap_FullLookupAtom("$trace_meta_call");
|
||||
AtomTrail = Yap_LookupAtom("trail");
|
||||
AtomTrue = Yap_LookupAtom("true");
|
||||
AtomTty = Yap_LookupAtom("tty");
|
||||
@ -504,6 +506,7 @@
|
||||
FunctorThreadRun = Yap_MkFunctor(AtomTopThreadGoal,2);
|
||||
FunctorThrow = Yap_MkFunctor(AtomThrow,1);
|
||||
FunctorTimeoutError = Yap_MkFunctor(AtomTimeoutError,2);
|
||||
FunctorTraceMetaCall = Yap_MkFunctor(AtomTraceMetaCall,3);
|
||||
FunctorTypeError = Yap_MkFunctor(AtomTypeError,2);
|
||||
FunctorUMinus = Yap_MkFunctor(AtomMinus,1);
|
||||
FunctorUPlus = Yap_MkFunctor(AtomPlus,1);
|
||||
|
@ -71,6 +71,9 @@ static void InitGlobal(void) {
|
||||
#endif /* THREADS */
|
||||
|
||||
|
||||
#if defined(THREADS)
|
||||
INIT_LOCK(GLOBAL_StreamDescLock);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
/* This file, ihstruct.h, was generated automatically by "yap -L misc/buildheap"
|
||||
please do not update, update misc/HEAPFIELDS instead */
|
||||
|
||||
/* This file, ihstruct.h , was generated automatically by "yap -L misc/buildheap"
|
||||
please do not update, update misc/HEAPFIELDS instead */
|
||||
|
||||
|
||||
|
||||
@ -179,6 +179,7 @@
|
||||
#endif
|
||||
PredGoalExpansion = RepPredProp(PredPropByFunc(FunctorGoalExpansion,USER_MODULE));
|
||||
PredMetaCall = RepPredProp(PredPropByFunc(FunctorMetaCall,PROLOG_MODULE));
|
||||
PredTraceMetaCall = RepPredProp(PredPropByFunc(FunctorTraceMetaCall,PROLOG_MODULE));
|
||||
PredDollarCatch = RepPredProp(PredPropByFunc(FunctorCatch,PROLOG_MODULE));
|
||||
PredRecordedWithKey = RepPredProp(PredPropByFunc(FunctorRecordedWithKey,PROLOG_MODULE));
|
||||
PredLogUpdClause = RepPredProp(PredPropByFunc(FunctorDoLogUpdClause,PROLOG_MODULE));
|
||||
|
@ -85,7 +85,9 @@ static void InitWorker(int wid) {
|
||||
REMOTE_ProfEnd(wid) = NULL;
|
||||
REMOTE_UncaughtThrow(wid) = FALSE;
|
||||
REMOTE_DoingUndefp(wid) = FALSE;
|
||||
REMOTE_StartLine(wid) = 0L;
|
||||
REMOTE_StartCharCount(wid) = 0L;
|
||||
REMOTE_StartLineCount(wid) = 0L;
|
||||
REMOTE_StartLinePos(wid) = 0L;
|
||||
InitScratchPad(wid);
|
||||
#ifdef COROUTINING
|
||||
REMOTE_WokenGoals(wid) = 0L;
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
/* This file, ratoms.h, was generated automatically by "yap -L misc/buildatoms"
|
||||
|
||||
/* This file, ratoms.h , was generated automatically by "yap -L misc/buildatoms"
|
||||
please do not update, update misc/ATOMS instead */
|
||||
|
||||
Atom3Dots = AtomAdjust(Atom3Dots);
|
||||
@ -81,6 +81,7 @@
|
||||
AtomDBTerm = AtomAdjust(AtomDBTerm);
|
||||
AtomDBref = AtomAdjust(AtomDBref);
|
||||
AtomDInteger = AtomAdjust(AtomDInteger);
|
||||
AtomDebugMeta = AtomAdjust(AtomDebugMeta);
|
||||
AtomDebuggerInput = AtomAdjust(AtomDebuggerInput);
|
||||
AtomDec10 = AtomAdjust(AtomDec10);
|
||||
AtomDefault = AtomAdjust(AtomDefault);
|
||||
@ -354,6 +355,7 @@
|
||||
AtomTimeoutError = AtomAdjust(AtomTimeoutError);
|
||||
AtomTopLevelGoal = AtomAdjust(AtomTopLevelGoal);
|
||||
AtomTopThreadGoal = AtomAdjust(AtomTopThreadGoal);
|
||||
AtomTraceMetaCall = AtomAdjust(AtomTraceMetaCall);
|
||||
AtomTrail = AtomAdjust(AtomTrail);
|
||||
AtomTrue = AtomAdjust(AtomTrue);
|
||||
AtomTty = AtomAdjust(AtomTty);
|
||||
@ -504,6 +506,7 @@
|
||||
FunctorThreadRun = FuncAdjust(FunctorThreadRun);
|
||||
FunctorThrow = FuncAdjust(FunctorThrow);
|
||||
FunctorTimeoutError = FuncAdjust(FunctorTimeoutError);
|
||||
FunctorTraceMetaCall = FuncAdjust(FunctorTraceMetaCall);
|
||||
FunctorTypeError = FuncAdjust(FunctorTypeError);
|
||||
FunctorUMinus = FuncAdjust(FunctorUMinus);
|
||||
FunctorUPlus = FuncAdjust(FunctorUPlus);
|
||||
|
@ -71,6 +71,9 @@ static void RestoreGlobal(void) {
|
||||
#endif /* THREADS */
|
||||
|
||||
|
||||
#if defined(THREADS)
|
||||
REINIT_LOCK(GLOBAL_StreamDescLock);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
/* This file, rhstruct.h, was generated automatically by "yap -L misc/buildheap"
|
||||
please do not update, update misc/HEAPFIELDS instead */
|
||||
|
||||
/* This file, rhstruct.h , was generated automatically by "yap -L misc/buildheap"
|
||||
please do not update, update misc/HEAPFIELDS instead */
|
||||
|
||||
|
||||
|
||||
@ -179,6 +179,7 @@
|
||||
#endif
|
||||
PredGoalExpansion = PtoPredAdjust(PredGoalExpansion);
|
||||
PredMetaCall = PtoPredAdjust(PredMetaCall);
|
||||
PredTraceMetaCall = PtoPredAdjust(PredTraceMetaCall);
|
||||
PredDollarCatch = PtoPredAdjust(PredDollarCatch);
|
||||
PredRecordedWithKey = PtoPredAdjust(PredRecordedWithKey);
|
||||
PredLogUpdClause = PtoPredAdjust(PredLogUpdClause);
|
||||
|
@ -87,6 +87,8 @@ static void RestoreWorker(int wid USES_REGS) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef COROUTINING
|
||||
REMOTE_WokenGoals(wid) = TermToGlobalAdjust(REMOTE_WokenGoals(wid));
|
||||
REMOTE_AttsMutableList(wid) = TermToGlobalAdjust(REMOTE_AttsMutableList(wid));
|
||||
|
10
H/tatoms.h
10
H/tatoms.h
@ -1,5 +1,5 @@
|
||||
|
||||
/* This file, tatoms.h, was generated automatically by "yap -L misc/buildatoms"
|
||||
|
||||
/* This file, tatoms.h , was generated automatically by "yap -L misc/buildatoms"
|
||||
please do not update, update misc/ATOMS instead */
|
||||
|
||||
Atom Atom3Dots_;
|
||||
@ -160,6 +160,8 @@
|
||||
#define AtomDBref Yap_heap_regs->AtomDBref_
|
||||
Atom AtomDInteger_;
|
||||
#define AtomDInteger Yap_heap_regs->AtomDInteger_
|
||||
Atom AtomDebugMeta_;
|
||||
#define AtomDebugMeta Yap_heap_regs->AtomDebugMeta_
|
||||
Atom AtomDebuggerInput_;
|
||||
#define AtomDebuggerInput Yap_heap_regs->AtomDebuggerInput_
|
||||
Atom AtomDec10_;
|
||||
@ -706,6 +708,8 @@
|
||||
#define AtomTopLevelGoal Yap_heap_regs->AtomTopLevelGoal_
|
||||
Atom AtomTopThreadGoal_;
|
||||
#define AtomTopThreadGoal Yap_heap_regs->AtomTopThreadGoal_
|
||||
Atom AtomTraceMetaCall_;
|
||||
#define AtomTraceMetaCall Yap_heap_regs->AtomTraceMetaCall_
|
||||
Atom AtomTrail_;
|
||||
#define AtomTrail Yap_heap_regs->AtomTrail_
|
||||
Atom AtomTrue_;
|
||||
@ -1006,6 +1010,8 @@
|
||||
#define FunctorThrow Yap_heap_regs->FunctorThrow_
|
||||
Functor FunctorTimeoutError_;
|
||||
#define FunctorTimeoutError Yap_heap_regs->FunctorTimeoutError_
|
||||
Functor FunctorTraceMetaCall_;
|
||||
#define FunctorTraceMetaCall Yap_heap_regs->FunctorTraceMetaCall_
|
||||
Functor FunctorTypeError_;
|
||||
#define FunctorTypeError Yap_heap_regs->FunctorTypeError_
|
||||
Functor FunctorUMinus_;
|
||||
|
Reference in New Issue
Block a user