[pure-lang-svn] SF.net SVN: pure-lang:[546] pure/trunk
Status: Beta
Brought to you by:
agraef
|
From: <ag...@us...> - 2008-08-20 08:07:18
|
Revision: 546
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=546&view=rev
Author: agraef
Date: 2008-08-20 08:07:27 +0000 (Wed, 20 Aug 2008)
Log Message:
-----------
Windows compatibility fixes.
Modified Paths:
--------------
pure/trunk/interpreter.cc
pure/trunk/lib/math.pure
pure/trunk/lib/primitives.pure
pure/trunk/runtime.cc
Modified: pure/trunk/interpreter.cc
===================================================================
--- pure/trunk/interpreter.cc 2008-08-20 06:43:39 UTC (rev 545)
+++ pure/trunk/interpreter.cc 2008-08-20 08:07:27 UTC (rev 546)
@@ -442,15 +442,15 @@
return t;
}
-static bool relname(const string& s)
+static bool absname(const string& s)
{
- if (s.empty()) return true;
+ if (s.empty())
+ return false;
+ else
#ifdef _WIN32
- size_t pos = fname.find('/');
- return pos == string::npos || pos == 0 ||
- pos == 2 && s[1] == ':';
+ return s[0]=='/' || s.size() >= 2 && s[1] == ':';
#else
- return s[0]!='/';
+ return s[0]=='/';
#endif
}
@@ -471,7 +471,7 @@
if (!workdir.empty() && workdir[workdir.size()-1] != '/')
workdir += "/";
string fname;
- if (relname(script)) {
+ if (!absname(script)) {
// resolve relative pathname
if (!search) {
fname = workdir+script;
@@ -495,7 +495,7 @@
} else
fname = script;
found:
- if (relname(fname)) fname = workdir+fname;
+ if (!absname(fname)) fname = workdir+fname;
char buf[BUFSIZE];
#ifndef _WIN32
if (chklink(fname)) {
@@ -546,7 +546,7 @@
if (!workdir.empty() && workdir[workdir.size()-1] != '/')
workdir += "/";
string fname;
- if (relname(lib)) {
+ if (!absname(lib)) {
// resolve relative pathname
if (!search) {
fname = workdir+lib;
Modified: pure/trunk/lib/math.pure
===================================================================
--- pure/trunk/lib/math.pure 2008-08-20 06:43:39 UTC (rev 545)
+++ pure/trunk/lib/math.pure 2008-08-20 08:07:27 UTC (rev 546)
@@ -76,11 +76,11 @@
/* Hyperbolic functions. */
extern double sinh(double), double cosh(double), double tanh(double);
-extern double asinh(double);
-extern double acosh(double) = c_acosh, double atanh(double) = c_atanh;
+extern double __asinh(double), double __acosh(double), double __atanh(double);
-acosh x::double = c_acosh x if x>=1.0;
-atanh x::double = c_atanh x if abs x<=1.0;
+asinh x::double = __asinh x;
+acosh x::double = __acosh x if x>=1.0;
+atanh x::double = __atanh x if abs x<=1.0;
sinh x::int | sinh x::bigint = sinh (double x);
cosh x::int | cosh x::bigint = cosh (double x);
Modified: pure/trunk/lib/primitives.pure
===================================================================
--- pure/trunk/lib/primitives.pure 2008-08-20 06:43:39 UTC (rev 545)
+++ pure/trunk/lib/primitives.pure 2008-08-20 08:07:27 UTC (rev 546)
@@ -108,7 +108,7 @@
/* Rounding functions. */
extern double floor(double), double ceil(double);
-extern double round(double), double trunc(double);
+extern double __round(double) = round, double __trunc(double) = trunc;
floor x::int | floor x::bigint = x;
ceil x::int | ceil x::bigint = x;
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-08-20 06:43:39 UTC (rev 545)
+++ pure/trunk/runtime.cc 2008-08-20 08:07:27 UTC (rev 546)
@@ -2696,7 +2696,41 @@
}
#endif
+/* Horrible kludge to get round, trunc and the inverse hyperbolic functions
+ from libmingwex.a (these are in C99, but not in the Windows system
+ libraries, and LLVM doesn't know how to get them either). */
+
extern "C"
+double __round(double x)
+{
+ return round(x);
+}
+
+extern "C"
+double __trunc(double x)
+{
+ return trunc(x);
+}
+
+extern "C"
+double __asinh(double x)
+{
+ return asinh(x);
+}
+
+extern "C"
+double __acosh(double x)
+{
+ return acosh(x);
+}
+
+extern "C"
+double __atanh(double x)
+{
+ return atanh(x);
+}
+
+extern "C"
int pure_fprintf(FILE *fp, const char *format)
{
return fprintf(fp, format);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|