mirror of https://github.com/vitalif/openscad
deal with test suite issues under mingw-cross compile and wine
parent
c1b1d0992f
commit
d5019a964e
|
@ -225,6 +225,14 @@ void includefile()
|
|||
finfo = locate_file((fs::path(filepath) / filename).string());
|
||||
}
|
||||
|
||||
if (!exists(finfo) || finfo.empty()) {
|
||||
// deal with some unusual situations with is_absolute() and Wine
|
||||
fs::path fnp( fs::path(filepath) / filename );
|
||||
if (fs::exists( fnp ) && !fs::is_directory( fnp )) {
|
||||
finfo = fnp;
|
||||
}
|
||||
}
|
||||
|
||||
if (finfo.empty()) {
|
||||
PRINTB("WARNING: Can't find 'include' file '%s'.", filename);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "printutils.h"
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
|
||||
std::list<std::string> print_messages_stack;
|
||||
|
@ -49,3 +50,24 @@ void PRINT_NOCACHE(const std::string &msg)
|
|||
outputhandler(msg, outputhandler_data);
|
||||
}
|
||||
}
|
||||
|
||||
std::string two_digit_exp_format( std::string doublestr )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
size_t exppos = doublestr.find('e');
|
||||
if ( exppos != std::string::npos) {
|
||||
exppos += 2;
|
||||
if ( doublestr[exppos] == '0' ) doublestr.erase(exppos,1);
|
||||
}
|
||||
#endif
|
||||
return doublestr;
|
||||
}
|
||||
|
||||
std::string two_digit_exp_format( double x )
|
||||
{
|
||||
std::stringstream s;
|
||||
s << x;
|
||||
return two_digit_exp_format( s.str() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,9 @@ void PRINT(const std::string &msg);
|
|||
void PRINT_NOCACHE(const std::string &msg);
|
||||
#define PRINTB_NOCACHE(_fmt, _arg) do { PRINT_NOCACHE(str(boost::format(_fmt) % _arg)); } while (0)
|
||||
|
||||
std::string two_digit_exp_format( std::string doublestr );
|
||||
std::string two_digit_exp_format( double x );
|
||||
|
||||
// extremely simple logging, eventually replace with something like boost.log
|
||||
// usage: logstream out(5); openscad_loglevel=6; out << "hi";
|
||||
static int openscad_loglevel = 0;
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include "context.h"
|
||||
#include "polyset.h"
|
||||
#include "builtin.h"
|
||||
#include "value.h"
|
||||
#include "printutils.h"
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <assert.h>
|
||||
|
@ -189,7 +191,7 @@ std::string TransformNode::toString() const
|
|||
stream << "[";
|
||||
for (int i=0;i<4;i++) {
|
||||
// FIXME: The 0 test is to avoid a leading minus before a single 0 (cosmetics)
|
||||
stream << ((this->matrix(j, i)==0)?0:this->matrix(j, i));
|
||||
stream << two_digit_exp_format((this->matrix(j, i)==0)?0:this->matrix(j, i));
|
||||
if (i != 3) stream << ", ";
|
||||
}
|
||||
stream << "]";
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include "value.h"
|
||||
#include "printutils.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
@ -197,6 +198,7 @@ public:
|
|||
if (dotpos != std::string::npos) {
|
||||
if (tmpstr.size() - dotpos > 12) tmpstr.erase(dotpos + 12);
|
||||
}
|
||||
tmpstr = two_digit_exp_format( tmpstr );
|
||||
return tmpstr;
|
||||
#else
|
||||
// attempt to emulate Qt's QString.sprintf("%g"); from old OpenSCAD.
|
||||
|
|
Loading…
Reference in New Issue