From 9709c590bf3a558212da95ef88e33739dfc06094 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Sat, 28 Mar 2015 19:38:54 +0000 Subject: [PATCH] YAP should not try to control cwd, that's the OS task --- H/pl-global.h | 6 +++--- H/pl-incl.h | 30 +++++++++++++++++++++++++++++- H/pl-yap.h | 19 ++----------------- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/H/pl-global.h b/H/pl-global.h index 148d0a125..b8744bc23 100755 --- a/H/pl-global.h +++ b/H/pl-global.h @@ -189,9 +189,9 @@ typedef struct { } cmdline; struct - { char * CWDdir; - size_t CWDlen; - char * executable; /* Running executable */ + { //char * CWDdir; + //size_t CWDlen; + //char * executable; /* Running executable */ #ifdef __WINDOWS__ char * module; /* argv[0] module passed */ #endif diff --git a/H/pl-incl.h b/H/pl-incl.h index b30ff96d1..40eef17ee 100755 --- a/H/pl-incl.h +++ b/H/pl-incl.h @@ -601,7 +601,7 @@ extern bool toldString(void); void closeFiles(int); atom_t PrologPrompt(void); word pl_exists_file(term_t name); -char *DirName(const char *f, char *dir); +char *DirName(const char *f); void outOfCore(void); word pl_noprotocol(void); @@ -697,6 +697,34 @@ extern int Unsetenv(char *name); extern int System(char *cmd); extern char *expandVars(const char *pattern, char *expanded, int maxlen); +PL_EXPORT(bool) ChDir(const char *X); + +#if _WIN32 || defined(__MINGW32__) +PL_EXPORT(char *) BaseName(const char *X); +PL_EXPORT(char *) DirName(const char *f); +#else +#define BaseName basename +#define DirName dirname +#endif + +PL_EXPORT(char *) OsPath(const char *X, char *Y); + + + +#define DeleteTemporaryFile(F) RemoveFile(stringAtom(F)) + +PL_EXPORT(intptr_t) lengthList(term_t list, int errors); +PL_EXPORT(int) promoteToFloatNumber(Number n); +PL_EXPORT(char *) PrologPath(const char *ospath, char *plpath, size_t len); +PL_EXPORT(char *) ExpandOneFile(const char *spec, char *file); +PL_EXPORT(char *) AbsoluteFile(const char *spec, char *path); +PL_EXPORT(int) IsAbsolutePath(const char *p); + PL_EXPORT(char *) OsPath(const char *plpath, char *ospath); + PL_EXPORT(int) IsAbsolutePath(const char *spec); +PL_EXPORT(bool) sysError(const char *fm, ...); +PL_EXPORT(int) setDoubleQuotes(atom_t a, unsigned int *flagp); + PL_EXPORT(int) getAccessLevelMask(atom_t a, access_level_t *val); + /**** SWI stuff (emulated in pl-yap.c) ****/ extern int writeAtomToStream(IOSTREAM *so, atom_t at); extern int valueExpression(term_t t, Number r ARG_LD); diff --git a/H/pl-yap.h b/H/pl-yap.h index 1707e9632..400870e4c 100644 --- a/H/pl-yap.h +++ b/H/pl-yap.h @@ -5,6 +5,8 @@ #include "Yatom.h" +#include + /* depends on tag schema, but 4 should always do */ #define LMASK_BITS 4 /* total # mask bits */ @@ -88,23 +90,6 @@ get_procedure(term_t descr, predicate_t *proc, term_t he, int f) { return TRUE; } -COMMON(intptr_t) lengthList(term_t list, int errors); -COMMON(int) promoteToFloatNumber(Number n); -COMMON(char *) PrologPath(const char *ospath, char *plpath, size_t len); -COMMON(char *) ExpandOneFile(const char *spec, char *file); -COMMON(char *) AbsoluteFile(const char *spec, char *path); -COMMON(char *) BaseName(const char *f); -COMMON(bool) ChDir(const char *path); -COMMON(char *) OsPath(const char *plpath, char *ospath); -COMMON(bool) ChDir(const char *path); -COMMON(int) DeleteTemporaryFile(atom_t name); -COMMON(int) IsAbsolutePath(const char *spec); - -COMMON(bool) sysError(const char *fm, ...); - -COMMON(int) setDoubleQuotes(atom_t a, unsigned int *flagp); - -COMMON(int) getAccessLevelMask(atom_t a, access_level_t *val); /* TBD */