fix headers

This commit is contained in:
Vitor Santos Costa 2016-06-17 17:11:00 +01:00
parent fdc01b0c27
commit eab3fc33be
7 changed files with 51 additions and 9 deletions

View File

@ -28,11 +28,11 @@
START_HEAP START_HEAP
/* memory management */ /* memory management */
UInt Yap_HoleSize void void UInt Yap_HoleSize
struct malloc_state *Yap_av void void
#if USE_DL_MALLOC #if USE_DL_MALLOC
struct Yap_MemoryHoles[MAX_DLMALLOC_HOLES] void void struct malloc_state *Yap_av
UInt Yap_NOfMemoryHoles void void struct memory_hole Yap_MemoryHoles[MAX_DLMALLOC_HOLES]
UInt Yap_NOfMemoryHoles
#if defined(YAPOR) || defined(THREADS) #if defined(YAPOR) || defined(THREADS)
lockvar DLMallocLock MkLock lockvar DLMallocLock MkLock
#endif #endif

10
H/Yap.h
View File

@ -256,6 +256,11 @@ INLINE_ONLY inline EXTERN size_t strnlen(const char *s, size_t maxlen) {
/* #define RANDOMIZE_START_ADDRESS 1 */ /* #define RANDOMIZE_START_ADDRESS 1 */
extern size_t Yap_page_size;
#ifdef USE_SYSTEM_MALLOC #ifdef USE_SYSTEM_MALLOC
#define HEAP_INIT_BASE 0L #define HEAP_INIT_BASE 0L
#define AtomBase NULL #define AtomBase NULL
@ -480,6 +485,11 @@ extern bool Yap_AccessAsset(const char *name, int mode);
extern bool Yap_AssetIsFile(const char *name); extern bool Yap_AssetIsFile(const char *name);
extern bool Yap_AssetIsDir(const char *name); extern bool Yap_AssetIsDir(const char *name);
extern int64_t Yap_AssetSize(const char *name); extern int64_t Yap_AssetSize(const char *name);
#else
#define __android_log_print(...)
#endif #endif
/************************************************************************************************* /*************************************************************************************************

View File

@ -33,7 +33,7 @@ Set or read system properties for _Param_:
YAP_FLAG(ADDRESS_BITS_FLAG, "address_bits", false, nat, BITNESS, YAP_FLAG(ADDRESS_BITS_FLAG, "address_bits", false, nat, BITNESS,
NULL), /** `address_bits` NULL), /** `address_bits`
Number of address bits in the machine, either 64 or 32 bits */ Number of address bits in the machine, either 64 or 32 bits */
YAP_FLAG(AGC_MARGIN_FLAG, "agc_margin", true, nat, "10000", YAP_FLAG(AGC_MARGIN_FLAG, "agc_margin", true, nat, "10000",
agc_threshold), /**`agc_margin ` agc_threshold), /**`agc_margin `
An integer: if this amount of atoms has been created since the last An integer: if this amount of atoms has been created since the last
@ -337,7 +337,8 @@ only if the query contains variables. The alternative, default in SWI-Prolog is
goal succeeded while leaving choicepoints. */ goal succeeded while leaving choicepoints. */
YAP_FLAG(QUASI_QUOTATIONS_FLAG, "quasi_quotations", true, booleanFlag, "true", YAP_FLAG(QUASI_QUOTATIONS_FLAG, "quasi_quotations", true, booleanFlag, "true",
NULL), NULL),
YAP_FLAG(READLINE_FLAG, "readline", true, booleanFlag, "false", Yap_InitReadline), /**< `readline(boolean, changeable)` YAP_FLAG(READLINE_FLAG, "readline", true, booleanFlag, "false" , Yap_InitReadline), /**< `readline(boolean, changeable)`
}
enable the use of the readline library for console interactions, true by default if readline was found. */ enable the use of the readline library for console interactions, true by default if readline was found. */
YAP_FLAG(REPORT_ERROR_FLAG, "report_error", true, booleanFlag, "true", NULL), YAP_FLAG(REPORT_ERROR_FLAG, "report_error", true, booleanFlag, "true", NULL),

View File

@ -61,7 +61,7 @@ typedef struct memory_hole {
ADDR start; ADDR start;
ADDR end; ADDR end;
} memory_hole_type; } memory_hole_type;
#endif #endif // USE_DL_MALLOC
typedef struct swi_reverse_hash { typedef struct swi_reverse_hash {
ADDR key; ADDR key;
@ -155,6 +155,7 @@ typedef struct thandle {
this is the data base: everything here should be possible to restore this is the data base: everything here should be possible to restore
********************/ ********************/
#if YAPOR #if YAPOR
typedef struct various_codes { typedef struct various_codes {
/* memory allocation and management */ /* memory allocation and management */
special_functors funcs; special_functors funcs;

View File

@ -1320,6 +1320,34 @@ static inline Term Yap_StringToNumber(Term t0 USES_REGS) {
return out.val.t; return out.val.t;
} }
static inline Atom Yap_TextToAtom(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS_CODES;
out.val.uc = NULL;
out.type = YAP_STRING_ATOM;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.a;
}
static inline Term Yap_TextToString(Term t0 USES_REGS) {
seq_tv_t inp, out;
inp.val.t = t0;
inp.type = YAP_STRING_ATOM | YAP_STRING_STRING | YAP_STRING_CODES | YAP_STRING_ATOMS_CODES;
out.val.uc = NULL;
out.type = YAP_STRING_STRING;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
static inline Term Yap_UTF8ToString(const char *s USES_REGS) { static inline Term Yap_UTF8ToString(const char *s USES_REGS) {
return MkStringTerm(s); return MkStringTerm(s);
} }

View File

@ -176,7 +176,7 @@ void Yap_InitDBPreds(void);
/* errors.c */ /* errors.c */
#if DEBUG #if DEBUG
void Yap_PrintPredName(struct pred_entry *ap); const char *Yap_PrintPredName(struct pred_entry *ap);
#endif #endif
void Yap_RestartYap(int); void Yap_RestartYap(int);
void Yap_exit(int); void Yap_exit(int);
@ -308,6 +308,7 @@ void Yap_CloseReadline(void);
bool Yap_InitReadline(Term t); bool Yap_InitReadline(Term t);
void Yap_InitItDeepenPreds(void); void Yap_InitItDeepenPreds(void);
struct AliasDescS *Yap_InitStandardAliases(void); struct AliasDescS *Yap_InitStandardAliases(void);
struct vfs *Yap_InitAssetManager(void);
/* load_foreign.c */ /* load_foreign.c */
void Yap_InitLoadForeign(void); void Yap_InitLoadForeign(void);
@ -355,7 +356,7 @@ void Yap_InitReadUtil(void);
/* qly.c */ /* qly.c */
void Yap_InitQLY(void); void Yap_InitQLY(void);
int Yap_Restore(const char *, const char *); YAP_file_type_t Yap_Restore(const char *, const char *);
void Yap_InitQLYR(void); void Yap_InitQLYR(void);
/* range.c */ /* range.c */

View File

@ -176,6 +176,7 @@ extern "C" {
or other mallocs available that do this. or other mallocs available that do this.
*/ */
#define DEBUG_DLMALLOC 1
#if DEBUG_DLMALLOC #if DEBUG_DLMALLOC
#include <assert.h> #include <assert.h>
#else #else