increase the ignore list

This commit is contained in:
Vítor Santos Costa 2015-06-17 23:49:02 +01:00
parent 4132854fbe
commit c26b5f3175
16 changed files with 5653 additions and 186 deletions

3792
C/x.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -78,7 +78,7 @@ typedef struct _PL_thread_info_t
} PL_thread_info_t;
PL_thread_info_t *SWI_thread_info(int tid, PL_thread_info_t *info);
intptr_t system_thread_id(PL_thread_info_t *info);
intptr_t system_thread_id(void);
#endif

View File

@ -1,4 +1,5 @@
#ifndef PL_INCL_H
#define PL_INCL_H 1
@ -46,6 +47,8 @@ typedef word * Word;
/* SWI internal name for a predicate */
typedef struct pred_entry * Procedure; /* predicate */
#ifndef SWI_H
/* try not to pollute the SWI space */
#ifdef P
#undef P
@ -60,6 +63,8 @@ typedef struct pred_entry * Procedure; /* predicate */
#undef H
#endif
#endif
/* swi code called from pl-incl.h */
/* should have messages here */
#ifdef DEBUG
@ -270,7 +275,7 @@ users foreign language code.
/********************************
* Error *
*********************************/
v *********************************/
#define isDefinedProcedure(pred) TRUE // TBD
#include "pl-error.h"
@ -438,6 +443,9 @@ it mean anything?
#define DBLQ_CHARS (0x0004) /* "ab" --> ['a', 'b'] */
#define DBLQ_ATOM (0x0008) /* "ab" --> 'ab' */
#define DBLQ_STRING (0x0010) /* "ab" --> "ab" */
#ifdef DBLQ_MASK
#undef DBLQ_MASK
#endif
#define DBLQ_MASK (DBLQ_CHARS|DBLQ_ATOM|DBLQ_STRING)
#define UNKNOWN_FAIL (0x0020) /* module */
#define UNKNOWN_WARNING (0x0040) /* module */

View File

@ -3,10 +3,98 @@
#define PL_SHARED_H
/* we are in YAP */
#ifndef __YAP_PROLOG__
#define __YAP_PROLOG__ 1
#include "pl-types.h"
#ifndef __WINDOWS__
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MSYS__)
#define __WINDOWS__ 1
#endif
#endif
#if !defined(O_PLMT) && !defined(YAPOR)
#define LOCAL_LD (GLOBAL_LD)
#define LD (GLOBAL_LD)
#define ARG1_LD void
#define ARG_LD
#define GET_LD
#define PRED_LD
#define PASS_LD
#define PASS_LD1
#define IGNORE_LD
#define REGS_FROM_LD
#define LD_FROM_REGS
#else
#define LOCAL_LD (__PL_ld)
#define LD LOCAL_LD
#define GET_LD CACHE_REGS struct PL_local_data *__PL_ld = GLOBAL_LD;
#define ARG1_LD struct PL_local_data *__PL_ld
#define ARG_LD , ARG1_LD
#define PASS_LD1 LD
#define PASS_LD , LD
#define PRED_LD GET_LD
#define IGNORE_LD (void)__PL_ld;
#define REGS_FROM_LD struct regstore_t *regcache = __PL_ld->reg_cache;
#define LD_FROM_REGS struct PL_local_data *__PL_ld = LOCAL_PL_local_data_p;
#endif
Atom YAP_AtomFromSWIAtom(atom_t at);
atom_t YAP_SWIAtomFromAtom(Atom at);
static inline Term
OpenList(int n USES_REGS)
{
Term t;
BACKUP_H();
while (HR+2*n > ASP-1024) {
if (!Yap_dogc( 0, (Term *)NULL PASS_REGS )) {
RECOVER_H();
return FALSE;
}
}
t = AbsPair(HR);
HR += 2*n;
RECOVER_H();
return t;
}
static inline Term
ExtendList(Term t0, Term inp)
{
Term t;
CELL *ptr = RepPair(t0);
BACKUP_H();
ptr[0] = inp;
ptr[1] = AbsPair(ptr+2);
t = AbsPair(ptr+2);
RECOVER_H();
return t;
}
static inline int
CloseList(Term t0, Term tail)
{
CELL *ptr = RepPair(t0);
RESET_VARIABLE(ptr-1);
if (!Yap_unify((Term)(ptr-1), tail))
return FALSE;
return TRUE;
}
#ifndef __YAP_PROLOG__
#include <assert.h>
@ -22,12 +110,6 @@
#define PL_KERNEL 1
#endif
#ifndef __WINDOWS__
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MSYS__)
#define __WINDOWS__ 1
#endif
#endif
// SWI Options
#define O_STRING 1
@ -59,7 +141,7 @@
#endif
#endif
#include <SWI-Stream.h>
//#include <SWI-Stream.h>
#include <SWI-Prolog.h>
#define COMMON(X) extern X
@ -90,39 +172,6 @@ typedef uintptr_t word; /* Anonymous 4 byte object */
#define GLOBAL_LD (LOCAL_PL_local_data_p)
#if !defined(O_PLMT) && !defined(YAPOR)
#define LOCAL_LD (GLOBAL_LD)
#define LD (GLOBAL_LD)
#define ARG1_LD void
#define ARG_LD
#define GET_LD
#define PRED_LD
#define PASS_LD
#define PASS_LD1
#define IGNORE_LD
#define REGS_FROM_LD
#define LD_FROM_REGS
#else
#define LOCAL_LD (__PL_ld)
#define LD LOCAL_LD
#define GET_LD CACHE_REGS struct PL_local_data *__PL_ld = GLOBAL_LD;
#define ARG1_LD struct PL_local_data *__PL_ld
#define ARG_LD , ARG1_LD
#define PASS_LD1 LD
#define PASS_LD , LD
#define PRED_LD GET_LD
#define IGNORE_LD (void)__PL_ld;
#define REGS_FROM_LD struct regstore_t *regcache = __PL_ld->reg_cache;
#define LD_FROM_REGS struct PL_local_data *__PL_ld = LOCAL_PL_local_data_p;
#endif
/*******************************
* STREAM I/O *
@ -247,7 +296,7 @@ typedef struct initialise_handle * InitialiseHandle;
/* Flags on module. Most of these flags are copied to the read context
in pl-read.c.
*/
#ifndef M_SYSTEM
#define M_SYSTEM (0x0001) /* system module */
#define M_CHARESCAPE (0x0002) /* module */
#define DBLQ_CHARS (0x0004) /* "ab" --> ['a', 'b'] */
@ -258,7 +307,7 @@ typedef struct initialise_handle * InitialiseHandle;
#define UNKNOWN_WARNING (0x0040) /* module */
#define UNKNOWN_ERROR (0x0080) /* module */
#define UNKNOWN_MASK (UNKNOWN_ERROR|UNKNOWN_WARNING|UNKNOWN_FAIL)
#endif
extern unsigned int
getUnknownModule(module_t m);
@ -303,85 +352,7 @@ COMMON(void) Yap_setCurrentSourceLocation( void *rd );
extern int raiseSignal(PL_local_data_t *ld, int sig);
#ifdef YATOM_H
static inline atom_t
AtomToSWIAtom(Atom at)
{
TranslationEntry *p;
if ((p = Yap_GetTranslationProp(at)) != NULL)
return (atom_t)(p->Translation*2+1);
return (atom_t)at;
}
#endif
static inline Atom
SWIAtomToAtom(atom_t at)
{
if ((CELL)at & 1)
return SWI_Atoms[at/2];
return (Atom)at;
}
Atom YAP_AtomFromSWIAtom(atom_t at);
atom_t YAP_SWIAtomFromAtom(Atom at);
/* This is silly, but let's keep it like that for now */
static inline Functor
SWIFunctorToFunctor(functor_t f)
{
if (((CELL)(f) & 2) && ((CELL)f) < N_SWI_FUNCTORS*4+2)
return SWI_Functors[((CELL)f)/4];
return (Functor)f;
}
static inline Term
OpenList(int n USES_REGS)
{
Term t;
BACKUP_H();
while (HR+2*n > ASP-1024) {
if (!Yap_dogc( 0, (Term *)NULL PASS_REGS )) {
RECOVER_H();
return FALSE;
}
}
t = AbsPair(HR);
HR += 2*n;
RECOVER_H();
return t;
}
static inline Term
ExtendList(Term t0, Term inp)
{
Term t;
CELL *ptr = RepPair(t0);
BACKUP_H();
ptr[0] = inp;
ptr[1] = AbsPair(ptr+2);
t = AbsPair(ptr+2);
RECOVER_H();
return t;
}
static inline int
CloseList(Term t0, Term tail)
{
CELL *ptr = RepPair(t0);
RESET_VARIABLE(ptr-1);
if (!Yap_unify((Term)(ptr-1), tail))
return FALSE;
return TRUE;
}
#endif /* YAP codee */
#endif /* PL_SHARED_INCLUDE */

View File

@ -0,0 +1,82 @@
/* $Id$
Part of SWI-Prolog
Author: Jan Wielemaker and Anjo Anjewierden
E-mail: jan@swi.psy.uva.nl
WWW: http://www.swi-prolog.org
Copyright (C): 1985-2002, University of Amsterdam
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef UTF8_H_INCLUDED
#define UTF8_H_INCLUDED
#include <wchar.h>
#define PL_MB_LEN_MAX 16
#define UTF8_MALFORMED_REPLACEMENT 0xfffd
#define ISUTF8_MB(c) ((unsigned)(c) >= 0xc0 && (unsigned)(c) <= 0xfd)
#define ISUTF8_CB(c) (((c)&0xc0) == 0x80) /* Is continuation byte */
#define ISUTF8_FB2(c) (((c)&0xe0) == 0xc0)
#define ISUTF8_FB3(c) (((c)&0xf0) == 0xe0)
#define ISUTF8_FB4(c) (((c)&0xf8) == 0xf0)
#define ISUTF8_FB5(c) (((c)&0xfc) == 0xf8)
#define ISUTF8_FB6(c) (((c)&0xfe) == 0xfc)
#define UTF8_FBN(c) (!(c&0x80) ? 0 : \
ISUTF8_FB2(c) ? 1 : \
ISUTF8_FB3(c) ? 2 : \
ISUTF8_FB4(c) ? 3 : \
ISUTF8_FB5(c) ? 4 : \
ISUTF8_FB6(c) ? 5 : -1)
#define UTF8_FBV(c,n) ( n == 0 ? c : (c & ((0x01<<(6-n))-1)) )
#define utf8_get_char(in, chr) \
(*(in) & 0x80 ? _PL__utf8_get_char(in, chr) \
: (*(chr) = *(in), (char *)(in)+1))
#define utf8_skip_char(in) \
(*(in) & 0x80 ? _PL__utf8_skip_char(in) \
: (char *)(in)+1)
#define utf8_put_char(out, chr) \
((chr) < 0x80 ? out[0]=(char)(chr), out+1 \
: _PL__utf8_put_char(out, (chr)))
extern char *_PL__utf8_get_char(const char *in, int *chr);
extern char *_PL__utf8_put_char(char *out, int chr);
extern char *_PL__utf8_skip_char(const char *out);
extern size_t utf8_strlen(const char *s, size_t len);
extern size_t utf8_strlen1(const char *s);
extern const char * utf8_skip(const char *s, int n);
extern int utf8_strncmp(const char *s1, const char *s2, size_t n);
extern int utf8_strprefix(const char *s1, const char *s2);
/// copy a wide string to an UTF-8 version.
extern char *utf8_wcscpy(char *sf, const wchar_t *s0);
typedef enum {
S_ASCII,
S_LATIN,
S_WIDE
} unicode_type_t;
extern unicode_type_t _PL__utf8_type(const char *in0, size_t len);
#endif /*UTF8_H_INCLUDED*/

View File

@ -34,8 +34,6 @@ typedef Term (*Func)(term_t); /* foreign functions */
extern const char *Yap_GetCurrentPredName(void);
extern Int Yap_GetCurrentPredArity(void);
extern term_t Yap_fetch_module_for_format(term_t args, Term *modp);
extern IOENC Yap_DefaultEncoding(void);
extern void Yap_SetDefaultEncoding(IOENC);
extern void Yap_setCurrentSourceLocation( void *rd );
extern void *Yap_GetStreamHandle(Atom at);
extern void Yap_WriteAtom(IOSTREAM *s, Atom atom);
@ -233,9 +231,9 @@ unblockSignal(int sig)
atom_t ATOM_;
#if THREADS
intptr_t system_thread_id(PL_thread_info_t *info);
intptr_t system_thread_id(void);
#endif
extern Term Yap_StringToTerm(const char *s, size_t len, term_t bindings);
extern Term Yap_StringToTerm(const char *s, size_t len, encoding_t enc, int prio,Term *bindingsp);
#endif /* PL_YAP_H */

View File

@ -41,7 +41,6 @@ static char SccsId[] = "%W% %G%";
#include "absmi.h"
#include "yapio.h"
#include "alloc.h"
#include "pl-incl.h"
#include <math.h>
#if STDC_HEADERS
#include <stdlib.h>
@ -111,8 +110,8 @@ static char SccsId[] = "%W% %G%";
static void
Yap_FileError(yap_error_number type, Term where, const char *format,...)
{
GET_LD
if ( truePrologFlag(PLFLAG_FILEERRORS) ) {
if ( trueLocalPrologFlag(FILEERRORS_FLAG) ) {
va_list ap;
va_start (ap, format);
@ -133,11 +132,11 @@ static Int p_system( USES_REGS1 );
static Int p_mv( USES_REGS1 );
static Int p_dir_sp( USES_REGS1 );
static void InitRandom(void);
static Int p_srandom( USES_REGS1 );
static Int p_alarm( USES_REGS1 );
static Int p_getenv( USES_REGS1 );
static Int p_putenv( USES_REGS1 );
static bool set_fpu_exceptions(bool);
static char *expandVars(const char *pattern, char *expanded, int maxlen);
#ifdef MACYAP
static int chdir(char *);
/* #define signal skel_signal */
@ -354,9 +353,12 @@ char *libdir = NULL;
#endif
int
IsAbsolutePath(const char *p)
bool
Yap_IsAbsolutePath(const char *p0)
{
// verify first if expansion is needed: ~/ or $HOME/
char c[MAXPATHLEN+1];
char *p = expandVars( p0, c, MAXPATHLEN );
#if _WIN32 || __MINGW32__
return !PathIsRelative(p);
#else
@ -375,6 +377,7 @@ yapExpandVars (const char *source, char *result)
{
const char *src = source;
char *res = result;
if(result == NULL)
result = malloc( YAP_FILENAME_MAX+1);
@ -458,14 +461,14 @@ yapExpandVars (const char *source, char *result)
return result;
}
char *
static char *
expandVars(const char *pattern, char *expanded, int maxlen)
{
return yapExpandVars(pattern, expanded);
#if ( __WIN32 || __MINGW32__ ) && defined(ENABLE_SYSTEM_EXPANSION)
DWORD retval=0;
// notice that the file does not need to exist1
// notice that the file does not need to exist
if (ini == NULL) {
ini = malloc(strlen(w)+1);
}
@ -574,13 +577,13 @@ unix2win( const char *source, char *target, int max)
#if O_XOS
char *
PrologPath(const char *p, char *buf, size_t len)
{ GET_LD
int flags = (truePrologFlag(PLFLAG_FILE_CASE) ? 0 : XOS_DOWNCASE);
{
int flags = (trueGlobalPrologFlag(PLFLAG_FILE_CASE) ? 0 : XOS_DOWNCASE);
return _xos_canonical_filename(p, buf, len, flags);
}
char *
static char *
OsPath(const char *p, char *buf)
{
if()z
@ -589,7 +592,7 @@ OsPath(const char *p, char *buf)
return buf;
}
#else
char *
static char *
OsPath(const char *X, char *Y) {
if (X!=Y && Y) strcpy(Y,X);
return (char *)Y ;
@ -602,9 +605,9 @@ OsPath(const char *X, char *Y) {
#define HAVE_WORDEXP 1
#endif
bool ChDir(const char *path) {
static bool ChDir(const char *path) {
bool rc = false;
char *qpath = AbsoluteFile(path, NULL);
char *qpath = Yap_AbsoluteFile(path, NULL);
#ifdef __ANDROID__
if (GLOBAL_AssetsWD) {
@ -630,7 +633,7 @@ bool ChDir(const char *path) {
}
#endif
#if _WIN32 || defined(__MINGW32__)
GET_LD
if ((rc = (SetCurrentDirectory(qpath) != 0)) == 0)
{
Yap_WinError("SetCurrentDirectory failed" );
@ -675,6 +678,7 @@ static char *myrealpath( const char *path, char *out)
{
#if _WIN32 || defined(__MINGW32__)
DWORD retval=0;
// notice that the file does not need to exist
retval = GetFullPathName(path,
YAP_FILENAME_MAX,
@ -713,9 +717,9 @@ static char *myrealpath( const char *path, char *out)
}
char *
AbsoluteFile(const char *spec, char *tmp)
Yap_AbsoluteFile(const char *spec, char *tmp)
{
GET_LD
char *rc;
char o[YAP_FILENAME_MAX+1];
#if _WIN32 || defined(__MINGW32__)
@ -731,7 +735,7 @@ AbsoluteFile(const char *spec, char *tmp)
return NULL;
}
}
if ( 1 || truePrologFlag(PLFLAG_FILEVARS) )
if ( 1 || trueGlobalPrologFlag(FILE_NAME_VARIABLES_FLAG) )
{
spec=expandVars(spec,o,YAP_FILENAME_MAX);
}
@ -741,7 +745,8 @@ AbsoluteFile(const char *spec, char *tmp)
return rc;
}
char *canoniseFileName( char *path) {
/*
static char *canoniseFileName( char *path) {
#if HAVE_REALPATH && HAVE_BASENAME
#if _WIN32 || defined(__MINGW32__)
char *o = malloc(YAP_FILENAME_MAX+1);
@ -763,13 +768,56 @@ char *canoniseFileName( char *path) {
return rc;
#endif
}
*/
atom_t TemporaryFile( const char *prefix, int *fd) {
static Int
absolute_file_name( USES_REGS1 )
{
Term t = Deref(ARG1);
const char *fp;
bool rc;
char s[MAXPATHLEN+1];
if (IsVarTerm(t)) {
Yap_Error(INSTANTIATION_ERROR, t, "absolute_file_name");
return false;
} else if (!IsAtomTerm(t)) {
Yap_Error(TYPE_ERROR_ATOM, t, "absolute_file_name");
return false;
}
if (!(fp = Yap_AbsoluteFile( RepAtom(AtomOfTerm(t))->StrOfAE, s)))
return false;
rc = Yap_unify(MkAtomTerm(Yap_LookupAtom(fp)), ARG2);
if (fp != s)
free( (void *)fp );
return rc;
}
static Int
prolog_to_os_filename( USES_REGS1 )
{
Term t = Deref(ARG1);
const char *fp;
char out[MAXPATHLEN+1];
if (IsVarTerm(t)) {
Yap_Error(INSTANTIATION_ERROR, t, "absolute_file_name");
return false;
} else if (!IsAtomTerm(t)) {
Yap_Error(TYPE_ERROR_ATOM, t, "absolute_file_name");
return false;
}
if (!(fp = OsPath( RepAtom(AtomOfTerm(t))->StrOfAE, out)))
return false;
return Yap_unify(MkAtomTerm(Yap_LookupAtom(fp)), ARG2);
}
Atom Yap_TemporaryFile( const char *prefix, int *fd) {
#if HAVE_MKSTEMP
char *tmp = malloc(PATH_MAX);
int n;
int f;
if (tmp == NULL) return (atom_t)0;
if (tmp == NULL) return NIL;
strncpy(tmp, prefix, PATH_MAX-1);
n = strlen( tmp );
if (n >= 6 &&
@ -785,9 +833,9 @@ atom_t TemporaryFile( const char *prefix, int *fd) {
f = mkstemp(tmp);
}
if (fd) *fd = f;
return YAP_SWIAtomFromAtom(Yap_LookupAtom(tmp));
return Yap_LookupAtom(tmp);
#else
return ATOM_nil;
return AtomNil;
#endif
}
@ -827,9 +875,8 @@ initSysPath(Term tlib, Term tcommons, bool dir_done, bool commons_done) {
if (! Yap_unify( tlib,
MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf))) )
return FALSE;
dir_done = true;
}
dir_done = true;
}
if (!commons_done) {
LOCAL_FileNameBuf[len] = '\0';
@ -905,20 +952,20 @@ initSysPath(Term tlib, Term tcommons, bool dir_done, bool commons_done) {
static Int
p_libraries_path( USES_REGS1 )
libraries_directories( USES_REGS1 )
{
return initSysPath( ARG1, ARG2 , false, false );
}
static Int
p_library_dir( USES_REGS1 )
system_library( USES_REGS1 )
{
return initSysPath( ARG1, MkVarTerm(), false, true );
}
static Int
p_commons_dir( USES_REGS1 )
commons_library( USES_REGS1 )
{
return initSysPath( MkVarTerm(), ARG1, true, false );
}
@ -1502,7 +1549,7 @@ real_cputime ()
static hrtime_t StartOfWTimes;
/* since last call to walltime */
#define LastWtime (*(hrtime_t *)ALIGN_BY_TYPE(LastWtimePtr,hrtime_t))
#define LastWtime (*(hrtime_t *)ALIGN_BY_TYPE(GLOBAL_LastWtimePtr,hrtime_t))
static void
InitWTime (void)
@ -1513,7 +1560,7 @@ InitWTime (void)
static void
InitLastWtime(void) {
/* ask for twice the space in order to guarantee alignment */
LastWtimePtr = (void *)Yap_AllocCodeSpace(2*sizeof(hrtime_t));
GLOBAL_LastWtimePtr = (void *)Yap_AllocCodeSpace(2*sizeof(hrtime_t));
LastWtime = StartOfWTimes;
}
@ -1542,7 +1589,7 @@ void Yap_walltime_interval(Int *now,Int *interval)
static struct timeval StartOfWTimes;
/* since last call to walltime */
#define LastWtime (*(struct timeval *)LastWtimePtr)
#define LastWtime (*(struct timeval *)GLOBAL_LastWtimePtr)
/* store user time in this variable */
static void
@ -1553,7 +1600,7 @@ InitWTime (void)
static void
InitLastWtime(void) {
LastWtimePtr = (void *)Yap_AllocCodeSpace(sizeof(struct timeval));
GLOBAL_LastWtimePtr = (void *)Yap_AllocCodeSpace(sizeof(struct timeval));
LastWtime.tv_usec = StartOfWTimes.tv_usec;
LastWtime.tv_sec = StartOfWTimes.tv_sec;
}
@ -1595,7 +1642,7 @@ void Yap_walltime_interval(Int *now,Int *interval)
static struct _timeb StartOfWTimes;
/* since last call to walltime */
#define LastWtime (*(struct timeb *)LastWtimePtr)
#define LastWtime (*(struct timeb *)GLOBAL_LastWtimePtr)
/* store user time in this variable */
static void
@ -1606,7 +1653,7 @@ InitWTime (void)
static void
InitLastWtime(void) {
LastWtimePtr = (void *)Yap_AllocCodeSpace(sizeof(struct timeb));
GLOBAL_LastWtimePtr = (void *)Yap_AllocCodeSpace(sizeof(struct timeb));
LastWtime.time = StartOfWTimes.time;
LastWtime.millitm = StartOfWTimes.millitm;
}
@ -1643,7 +1690,7 @@ void Yap_walltime_interval(Int *now,Int *interval)
static clock_t StartOfWTimes;
#define LastWtime (*(clock_t *)LastWtimePtr)
#define LastWtime (*(clock_t *)GLOBAL_LastWtimePtr)
/* store user time in this variable */
static void
@ -1654,7 +1701,7 @@ InitWTime (void)
static void
InitLastWtime(void) {
LastWtimePtr = (void *)Yap_AllocCodeSpace(sizeof(clock_t));
GLOBAL_LastWtimePtr = (void *)Yap_AllocCodeSpace(sizeof(clock_t));
LastWtime = StartOfWTimes;
}
@ -1671,7 +1718,7 @@ void Yap_walltime_interval(Int *now,Int *interval)
clock_t t;
t = times(NULL);
*now = ((t - StartOfWTimes)*1000) / TicksPerSec;
*interval = (t - LastWtime) * 1000 / TicksPerSec;
*interval = (t - GLOBAL_LastWtime) * 1000 / TicksPerSec;
}
#endif /* HAVE_TIMES */
@ -1776,7 +1823,7 @@ p_release_random_state ( USES_REGS1 )
#endif
static Int
p_srandom ( USES_REGS1 )
Srandom ( USES_REGS1 )
{
register Term t0 = Deref (ARG1);
if (IsVarTerm (t0)) {
@ -2320,11 +2367,6 @@ MSCHandleSignal(DWORD dwCtrlType) {
return volume_header(file);
}
char * PL_cwd(char *cwd, size_t cwdlen)
{
return (char *)Yap_getcwd( (const char *)cwd, cwdlen );
}
const char * Yap_getcwd(const char *cwd, size_t cwdlen)
{
#if _WIN32 || defined(__MINGW32__)
@ -2334,17 +2376,35 @@ MSCHandleSignal(DWORD dwCtrlType) {
return NULL;
}
return (char *)cwd;
#else
#if __ANDROID__
#elif __ANDROID__
if (GLOBAL_AssetsWD) {
return strncpy( (char *)cwd, (const char *)GLOBAL_AssetsWD, cwdlen);
}
#endif
return getcwd((char *)cwd, cwdlen);
#endif
}
static Int
working_directory(USES_REGS1)
{
char dir[YAP_FILENAME_MAX+1];
Term t1 = Deref(ARG1), t2;
if ( !IsVarTerm( t1 ) && !IsAtomTerm(t1) ) {
Yap_Error(TYPE_ERROR_ATOM, t1, "working_directory");
}
if (!Yap_unify( t1, MkAtomTerm(Yap_LookupAtom(Yap_getcwd(dir,YAP_FILENAME_MAX )))) )
return false;
t2 = Deref(ARG2);
if ( IsVarTerm( t2 ) ) {
Yap_Error(INSTANTIATION_ERROR, t2, "working_directory");
}
if ( !IsAtomTerm(t2) ) {
Yap_Error(TYPE_ERROR_ATOM, t2, "working_directory");
}
ChDir(RepAtom(AtomOfTerm(t2))->StrOfAE);
return true;
}
static char *
expandWithPrefix(const char *source, const char *root, char *result)
@ -2355,12 +2415,12 @@ MSCHandleSignal(DWORD dwCtrlType) {
work = expandVars( source, ares1, YAP_FILENAME_MAX);
// expand names first
if (root && !IsAbsolutePath( source ) ) {
if (root && !Yap_IsAbsolutePath( source ) ) {
char ares2[YAP_FILENAME_MAX+1];
strncpy( ares2, root, YAP_FILENAME_MAX );
strncat( ares2, "/", YAP_FILENAME_MAX );
strncat( ares2, work, YAP_FILENAME_MAX );
return AbsoluteFile( ares2, result );
return Yap_AbsoluteFile( ares2, result );
} else {
// expand path
return myrealpath( work, result);
@ -3335,8 +3395,8 @@ MSCHandleSignal(DWORD dwCtrlType) {
Yap_ReInitWallTime (void)
{
InitWTime();
if (Yap_heap_regs->last_wtime != NULL)
Yap_FreeCodeSpace(Yap_heap_regs->last_wtime);
if (Yap_global->LastWtimePtr_ != NULL)
Yap_FreeCodeSpace(Yap_global->LastWtimePtr_);
InitLastWtime();
}
@ -3615,23 +3675,24 @@ MSCHandleSignal(DWORD dwCtrlType) {
/* can only do after heap is initialised */
InitLastWtime();
Yap_InitCPred ("srandom", 1, p_srandom, SafePredFlag);
Yap_InitCPred ("srandom", 1, Srandom, SafePredFlag);
#if HAVE_RANDOM
Yap_InitCPred ("init_random_state", 3, p_init_random_state, SafePredFlag);
Yap_InitCPred ("set_random_state", 2, p_set_random_state, SafePredFlag);
Yap_InitCPred ("release_random_state", 1, p_release_random_state, SafePredFlag);
#endif
Yap_InitCPred ("$absolute_file_name", 2, absolute_file_name, SafePredFlag|SyncPredFlag);
Yap_InitCPred ("log_event", 1, p_log_event, SafePredFlag|SyncPredFlag);
Yap_InitCPred ("sh", 0, p_sh, SafePredFlag|SyncPredFlag);
Yap_InitCPred ("$shell", 1, p_shell, SafePredFlag|SyncPredFlag|UserCPredFlag);
Yap_InitCPred ("$shell", 1, p_shell, SafePredFlag|SyncPredFlag);
Yap_InitCPred ("system", 1, p_system, SafePredFlag|SyncPredFlag|UserCPredFlag);
Yap_InitCPred ("rename", 2, p_mv, SafePredFlag|SyncPredFlag);
Yap_InitCPred ("$yap_home", 1, p_yap_home, SafePredFlag);
Yap_InitCPred ("$yap_paths", 3, p_yap_paths, SafePredFlag);
Yap_InitCPred ("$dir_separator", 1, p_dir_sp, SafePredFlag);
Yap_InitCPred ("libraries_directories",2, p_libraries_path, 0);
Yap_InitCPred ("system_library", 1, p_library_dir, 0);
Yap_InitCPred ("commons_library", 1, p_commons_dir, 0);
Yap_InitCPred ("libraries_directories",2, libraries_directories, 0);
Yap_InitCPred ("system_library", 1, system_library, 0);
Yap_InitCPred ("commons_library", 1, commons_library, 0);
Yap_InitCPred ("$alarm", 4, p_alarm, SafePredFlag|SyncPredFlag);
Yap_InitCPred ("$getenv", 2, p_getenv, SafePredFlag);
Yap_InitCPred ("$putenv", 2, p_putenv, SafePredFlag|SyncPredFlag);
@ -3643,6 +3704,8 @@ MSCHandleSignal(DWORD dwCtrlType) {
Yap_InitCPred ("$ld_path", 1, p_ld_path, SafePredFlag);
Yap_InitCPred ("$address_bits", 1, p_address_bits, SafePredFlag);
Yap_InitCPred ("$expand_file_name", 2, p_expand_file_name, SyncPredFlag);
Yap_InitCPred ("working_directory", 2,working_directory, SyncPredFlag);
Yap_InitCPred ("prolog_to_os_filename", 2, prolog_to_os_filename, SyncPredFlag);
Yap_InitCPred ("$fpe_error", 0, p_fpe_error, 0);
#ifdef _WIN32
Yap_InitCPred ("win_registry_get_value", 3, p_win_registry_get_value,0);

View File

@ -1,4 +1,224 @@
/******************************************************************************\
/****************************************************************************** \
* *
* SimpleCUDD library (www.cs.kuleuven.be/~theo/tools/simplecudd.html) *
* SimpleCUDD was developed at Katholieke Universiteit Leuven(www.kuleuven.be) *

View File

@ -193,6 +193,7 @@
#include <math.h>
#include <time.h>
#include "config.h"
#include "../cudd_config.h"
#if HAVE_UTIL_H
#include <util.h>
#endif

View File

@ -192,6 +192,7 @@
#include <time.h>
#include "pqueue.h"
#include "config.h"
#include "../cudd_config.h"
#if HAVE_UTIL_H
#include <util.h>
#endif

View File