From b9f1885f0a85d1a9d68dc2b0fe6bf070e93126cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Mon, 21 Jan 2013 09:36:50 +0000 Subject: [PATCH] use version from swi --- H/pl-incl.h | 7 +++++++ H/pl-yap.h | 2 ++ os/pl-prologflag.c | 7 +------ os/pl-version.c | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 os/pl-version.c diff --git a/H/pl-incl.h b/H/pl-incl.h index ce5e4ed4f..261c8563d 100755 --- a/H/pl-incl.h +++ b/H/pl-incl.h @@ -43,6 +43,9 @@ #include "Yap.h" #include "YapHeap.h" +#define PLVERSION YAP_VERSION +#define PLNAME "yap" + /* try not to pollute the SWI space */ #ifdef P #undef P @@ -893,6 +896,10 @@ COMMON(char) digitName(int n, int sm); /**** stuff from pl-utf8.c ****/ size_t utf8_strlen(const char *s, size_t len); +/**** stuff from pl-version.c ****/ +COMMON(void) setGITVersion(void); + + /**** stuff from pl-write.c ****/ COMMON(char *) varName(term_t var, char *buf); COMMON(int) writeUCSAtom(IOSTREAM *fd, atom_t atom, int flags); diff --git a/H/pl-yap.h b/H/pl-yap.h index 83adab8e9..99187bce5 100644 --- a/H/pl-yap.h +++ b/H/pl-yap.h @@ -95,6 +95,8 @@ COMMON(bool) ChDir(const char *path); COMMON(int) DeleteTemporaryFile(atom_t name); COMMON(int) IsAbsolutePath(const char *spec); +COMMON(bool) sysError(const char *fm, ...); + /* TBD */ extern word globalString(size_t size, char *s); diff --git a/os/pl-prologflag.c b/os/pl-prologflag.c index fc1d4db19..91d253777 100644 --- a/os/pl-prologflag.c +++ b/os/pl-prologflag.c @@ -75,9 +75,7 @@ too much. static void setArgvPrologFlag(void); #endif static void setTZPrologFlag(void); -#ifndef __YAP_PROLOG__ static void setVersionPrologFlag(void); -#endif static atom_t lookupAtomFlag(atom_t key); static void initPrologFlagTable(void); @@ -1204,8 +1202,8 @@ initPrologFlags(void) setTZPrologFlag(); #ifndef __YAP_PROLOG__ setOSPrologFlags(); - setVersionPrologFlag(); #endif /* YAP_PROLOG */ + setVersionPrologFlag(); } @@ -1241,8 +1239,6 @@ setTZPrologFlag(void) setPrologFlag("timezone", FT_INTEGER|FF_READONLY, timezone); } -#ifndef __YAP_PROLOG__ - static void setVersionPrologFlag(void) { GET_LD @@ -1265,7 +1261,6 @@ setVersionPrologFlag(void) setGITVersion(); } -#endif /* YAP_PROLOG */ void cleanupPrologFlags(void) diff --git a/os/pl-version.c b/os/pl-version.c new file mode 100644 index 000000000..5bf57382c --- /dev/null +++ b/os/pl-version.c @@ -0,0 +1,36 @@ +/* $Id$ + + Part of SWI-Prolog + + Author: Jan Wielemaker + E-mail: wielemak@science.uva.nl + WWW: http://www.swi-prolog.org + Copyright (C): 1985-2007, 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 +*/ + +#include "pl-incl.h" +#ifdef USE_GIT_VERSION_H +#include +#endif + +void +setGITVersion(void) +{ +#ifdef GIT_VERSION + PL_set_prolog_flag("version_git", PL_ATOM|FF_READONLY, GIT_VERSION); +#endif +}