Browse Source

Reimplement SyRealPath(); fix build.

pull/21/head
Rafal Kupiec 3 years ago
parent
commit
e2aa774a6a
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
  1. 10
      engine/lib/utils.c
  2. 2
      engine/vfs.c
  3. 5
      include/ph7.h
  4. 1
      include/ph7int.h

10
engine/lib/utils.c

@ -628,4 +628,14 @@ PH7_PRIVATE sxi32 SyStrToReal(const char *zSrc, sxu32 nLen, void *pOutVal, const
*(sxreal *)pOutVal = Val;
}
return zSrc >= zEnd ? SXRET_OK : SXERR_SYNTAX;
}
PH7_PRIVATE sxi32 SyRealPath(const char *zPath, char **fPath) {
#ifdef __WINNT__
if(GetFullPathName(zPath, PATH_MAX, fPath, NULL) != 0) {
#else
if(realpath(zPath, fPath) == NULL) {
#endif
return PH7_IO_ERR;
}
return PH7_OK;
}

2
engine/vfs.c

@ -2916,7 +2916,7 @@ PH7_PRIVATE void *PH7_StreamOpenHandle(ph7_vm *pVm, const ph7_io_stream *pStream
if(rc == PH7_OK) {
if(bPushInclude) {
/* Mark as included */
PH7_VmPushFilePath(pVm, sFile.zString, FALSE, pNew);
PH7_VmPushFilePath(pVm, sFile.zString, -1, FALSE, pNew);
}
}
} else {

5
include/ph7.h

@ -50,6 +50,11 @@
/* $SymiscID: ph7.h v2.1 UNIX|WIN32/64 2012-09-15 09:43 stable <chm@symisc.net> $ */
#include <stdarg.h> /* needed for the definition of va_list */
#include <stdio.h> /* needed for the definition of snprintf */
#include <limits.h> /* needed for MAX_PATH */
#ifndef PATH_MAX
#define PATH_MAX MAX_PATH
#endif
/*
* Compile time engine version, signature, identification in the symisc source tree
* and copyright notice.

1
include/ph7int.h

@ -1772,6 +1772,7 @@ PH7_PRIVATE sxi32 SyLexInit(SyLex *pLex, SySet *pSet, ProcTokenizer xTokenizer,
PH7_PRIVATE sxi32 SyBase64Encode(const char *zSrc, sxu32 nLen, ProcConsumer xConsumer, void *pUserData);
#endif /* PH7_DISABLE_BUILTIN_FUNC */
PH7_PRIVATE sxi32 SyStrToReal(const char *zSrc, sxu32 nLen, void *pOutVal, const char **zRest);
PH7_PRIVATE sxi32 SyRealPath(const char *zPath, char **fPath);
PH7_PRIVATE sxi32 SyBinaryStrToInt64(const char *zSrc, sxu32 nLen, void *pOutVal, const char **zRest);
PH7_PRIVATE sxi32 SyOctalStrToInt64(const char *zSrc, sxu32 nLen, void *pOutVal, const char **zRest);
PH7_PRIVATE sxi32 SyHexStrToInt64(const char *zSrc, sxu32 nLen, void *pOutVal, const char **zRest);

Loading…
Cancel
Save