mirror of https://github.com/vitalif/openscad
add boosty.h for compatability with boost <1.44
parent
10701f7158
commit
65a1c9cf6c
|
@ -33,6 +33,7 @@
|
|||
#include <boost/foreach.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
using namespace boost::filesystem;
|
||||
#include "boosty.h"
|
||||
|
||||
std::vector<const Context*> Context::ctx_stack;
|
||||
|
||||
|
@ -176,7 +177,7 @@ AbstractNode *Context::evaluate_module(const ModuleInstantiation &inst) const
|
|||
std::string Context::getAbsolutePath(const std::string &filename) const
|
||||
{
|
||||
if (!filename.empty()) {
|
||||
return absolute(path(this->document_path) / filename).string();
|
||||
return boosty::absolute(path(this->document_path) / filename).string();
|
||||
}
|
||||
else {
|
||||
return filename;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <boost/regex.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
using namespace boost::filesystem;
|
||||
#include "boosty.h"
|
||||
|
||||
boost::unordered_set<std::string> dependencies;
|
||||
const char *make_command = NULL;
|
||||
|
@ -14,7 +15,7 @@ const char *make_command = NULL;
|
|||
void handle_dep(const std::string &filename)
|
||||
{
|
||||
path filepath(filename);
|
||||
if (filepath.is_absolute()) {
|
||||
if ( boosty::is_absolute( filepath )) {
|
||||
dependencies.insert(filename);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
using namespace boost::filesystem;
|
||||
#include <boost/assign/std/vector.hpp>
|
||||
using namespace boost::assign; // bring 'operator+=()' into scope
|
||||
#include "boosty.h"
|
||||
|
||||
class ImportModule : public AbstractModule
|
||||
{
|
||||
|
@ -81,7 +82,8 @@ AbstractNode *ImportModule::evaluate(const Context *ctx, const ModuleInstantiati
|
|||
std::string filename = c.getAbsolutePath(v.text);
|
||||
import_type_e actualtype = this->type;
|
||||
if (actualtype == TYPE_UNKNOWN) {
|
||||
std::string ext = boost::algorithm::to_lower_copy(path(filename).extension().string());
|
||||
std::string extraw = boosty::extension_str( path(filename) );
|
||||
std::string ext = boost::algorithm::to_lower_copy( extraw );
|
||||
if (ext == ".stl") actualtype = TYPE_STL;
|
||||
else if (ext == ".off") actualtype = TYPE_OFF;
|
||||
else if (ext == ".dxf") actualtype = TYPE_DXF;
|
||||
|
|
11
src/lexer.l
11
src/lexer.l
|
@ -35,6 +35,7 @@
|
|||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
#include "boosty.h"
|
||||
|
||||
//isatty for visual c++ and mingw-cross-env
|
||||
#if defined __WIN32__ && ! defined _MSC_VER
|
||||
|
@ -109,13 +110,13 @@ use[ \t\r\n>]*"<" { BEGIN(cond_use); }
|
|||
">" {
|
||||
BEGIN(INITIAL);
|
||||
fs::path usepath;
|
||||
if (fs::path(filename).is_absolute()) {
|
||||
if ( boosty::is_absolute( fs::path(filename) ) ) {
|
||||
usepath = filename;
|
||||
}
|
||||
else {
|
||||
usepath = fs::path(parser_source_path) / filename;
|
||||
if (!fs::exists(usepath)) {
|
||||
usepath = fs::absolute(fs::path(librarydir) / filename);
|
||||
usepath = boosty::absolute(fs::path(librarydir) / filename);
|
||||
}
|
||||
}
|
||||
handle_dep(usepath.string());
|
||||
|
@ -198,7 +199,7 @@ void includefile()
|
|||
|
||||
fs::path dirinfo = sourcepath();
|
||||
if (!filepath.empty()) {
|
||||
if (fs::path(filepath).is_absolute()) {
|
||||
if (boosty::is_absolute( fs::path(filepath) ) ) {
|
||||
dirinfo = filepath;
|
||||
}
|
||||
else {
|
||||
|
@ -214,8 +215,8 @@ void includefile()
|
|||
filepath.clear();
|
||||
path_stack.push_back(dirinfo);
|
||||
|
||||
handle_dep(fs::absolute(finfo).string());
|
||||
yyin = fopen(fs::absolute(finfo).string().c_str(), "r");
|
||||
handle_dep(boosty::absolute(finfo).string());
|
||||
yyin = fopen(boosty::absolute(finfo).string().c_str(), "r");
|
||||
if (!yyin) {
|
||||
PRINTF("WARNING: Can't open input file `%s'.", filename.c_str());
|
||||
path_stack.pop_back();
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
|
||||
#include <boost/program_options.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "boosty.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define snprintf _snprintf
|
||||
|
@ -199,7 +200,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
#endif
|
||||
|
||||
currentdir = fs::current_path().generic_string();
|
||||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
QDir exdir(QApplication::instance()->applicationDirPath());
|
||||
#ifdef Q_WS_MAC
|
||||
|
@ -273,11 +274,13 @@ int main(int argc, char **argv)
|
|||
}
|
||||
fclose(fp);
|
||||
text << commandline_commands;
|
||||
root_module = parse(text.str().c_str(), fs::absolute(filename).generic_string().c_str(), false);
|
||||
fs::path abspath = boosty::absolute( filename );
|
||||
std::string fname = boosty::stringy( abspath );
|
||||
root_module = parse(text.str().c_str(), fname.c_str(), false);
|
||||
if (!root_module) exit(1);
|
||||
}
|
||||
|
||||
fs::path fpath = fs::absolute(fs::path(filename));
|
||||
fs::path fpath = boosty::absolute( fs::path(filename) );
|
||||
fs::path fparent = fpath.parent_path();
|
||||
fs::current_path( fparent );
|
||||
|
||||
|
@ -374,7 +377,9 @@ int main(int argc, char **argv)
|
|||
#endif
|
||||
|
||||
QString qfilename;
|
||||
if (filename) qfilename = QString::fromStdString(fs::absolute(filename).string());
|
||||
fs::path abspath = boosty::absolute( filename );
|
||||
std::string absname = boosty::stringy( abspath );
|
||||
if (filename) qfilename = QString::fromStdString( absname );
|
||||
|
||||
#if 0 /*** disabled by clifford wolf: adds rendering artefacts with OpenCSG ***/
|
||||
// turn on anti-aliasing
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <boost/filesystem.hpp>
|
||||
|
||||
using namespace boost::filesystem;
|
||||
#include "boosty.h"
|
||||
|
||||
int parser_error_pos = -1;
|
||||
|
||||
|
@ -641,7 +642,8 @@ Module *Module::compile_library(const std::string &filename)
|
|||
libs_cache[filename] = e;
|
||||
|
||||
Module *backup_mod = module;
|
||||
Module *lib_mod = dynamic_cast<Module*>(parse(text.str().c_str(), path(filename).parent_path().generic_string().c_str(), 0));
|
||||
std::string pathname = boosty::stringy( fs::path(filename).parent_path() );
|
||||
Module *lib_mod = dynamic_cast<Module*>(parse(text.str().c_str(), pathname.c_str(), 0));
|
||||
module = backup_mod;
|
||||
|
||||
if (lib_mod) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <boost/filesystem.hpp>
|
||||
|
||||
using namespace boost::filesystem;
|
||||
#include "boosty.h"
|
||||
|
||||
std::string librarydir;
|
||||
|
||||
|
@ -14,14 +15,14 @@ void parser_init(const std::string &applicationpath)
|
|||
if (!is_directory(libdir / "libraries")) libdir /= "../../..";
|
||||
#elif defined(Q_OS_UNIX)
|
||||
if (is_directory(tmpdir = libdir / "../share/openscad/libraries")) {
|
||||
librarydir = tmpdir.generic_string();
|
||||
librarydir = boosty::stringy( tmpdir );
|
||||
} else if (is_directory(tmpdir = libdir / "../../share/openscad/libraries")) {
|
||||
librarydir = tmpdir.generic_string();
|
||||
librarydir = boosty::stringy( tmpdir );
|
||||
} else if (is_directory(tmpdir = libdir / "../../libraries")) {
|
||||
librarydir = tmpdir.generic_string();
|
||||
librarydir = boosty::stringy( tmpdir );
|
||||
} else
|
||||
#endif
|
||||
if (is_directory(tmpdir = libdir / "libraries")) {
|
||||
librarydir = tmpdir.generic_string();
|
||||
if (is_directory(tmpdir = libdir / "libraries")) {
|
||||
librarydir = boosty::stringy( tmpdir );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,10 +125,7 @@ if (NOT $ENV{BOOSTDIR} STREQUAL "")
|
|||
message(STATUS "BOOST_ROOT: " ${BOOST_ROOT})
|
||||
endif()
|
||||
|
||||
find_package( Boost 1.44.0 COMPONENTS thread program_options filesystem system regex REQUIRED)
|
||||
if ( ${Boost_VERSION} VERSION_LESS "104601" )
|
||||
add_definitions( -DBOOST_FILESYSTEM_VERSION=3 )
|
||||
endif()
|
||||
find_package( Boost 1.42.0 COMPONENTS thread program_options filesystem system regex REQUIRED)
|
||||
message(STATUS "Boost includes found: " ${Boost_INCLUDE_DIRS})
|
||||
message(STATUS "Boost libraries found:")
|
||||
foreach(boostlib ${Boost_LIBRARIES})
|
||||
|
|
|
@ -53,6 +53,7 @@ namespace fs = boost::filesystem;
|
|||
|
||||
#include <boost/program_options.hpp>
|
||||
namespace po = boost::program_options;
|
||||
#include "boosty.h"
|
||||
|
||||
std::string commandline_commands;
|
||||
std::string currentdir;
|
||||
|
@ -135,7 +136,7 @@ int main(int argc, char **argv)
|
|||
QApplication app(argc, argv, false);
|
||||
fs::path original_path = fs::current_path();
|
||||
|
||||
currentdir = fs::current_path().generic_string();
|
||||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QApplication::instance()->applicationDirPath().toStdString());
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
#include "boosty.h"
|
||||
|
||||
std::string commandline_commands;
|
||||
std::string currentdir;
|
||||
|
@ -108,7 +109,7 @@ int main(int argc, char **argv)
|
|||
QApplication app(argc, argv, false);
|
||||
fs::path original_path = fs::current_path();
|
||||
|
||||
currentdir = fs::current_path().generic_string();
|
||||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QApplication::instance()->applicationDirPath().toStdString());
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
#include "boosty.h"
|
||||
|
||||
std::string commandline_commands;
|
||||
std::string currentdir;
|
||||
|
@ -94,7 +95,7 @@ int main(int argc, char **argv)
|
|||
QApplication app(argc, argv, false);
|
||||
fs::path original_path = fs::current_path();
|
||||
|
||||
currentdir = fs::current_path().generic_string();
|
||||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QApplication::instance()->applicationDirPath().toStdString());
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
#include "boosty.h"
|
||||
|
||||
std::string commandline_commands;
|
||||
std::string currentdir;
|
||||
|
@ -87,7 +88,7 @@ int main(int argc, char **argv)
|
|||
QApplication app(argc, argv, false);
|
||||
fs::path original_path = fs::current_path();
|
||||
|
||||
currentdir = fs::current_path().generic_string();
|
||||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QApplication::instance()->applicationDirPath().toStdString());
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
#include "boosty.h"
|
||||
|
||||
std::string commandline_commands;
|
||||
std::string currentdir;
|
||||
|
@ -73,7 +74,7 @@ int main(int argc, char **argv)
|
|||
QApplication app(argc, argv, false);
|
||||
fs::path original_path = fs::current_path();
|
||||
|
||||
currentdir = fs::current_path().generic_string();
|
||||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QApplication::instance()->applicationDirPath().toStdString());
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
namespace po = boost::program_options;
|
||||
namespace fs = boost::filesystem;
|
||||
#include "boosty.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
@ -254,7 +255,7 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type)
|
|||
|
||||
fs::path original_path = fs::current_path();
|
||||
|
||||
std::string currentdir = fs::current_path().generic_string();
|
||||
std::string currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QApplication::instance()->applicationDirPath().toStdString());
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
#include "boosty.h"
|
||||
|
||||
std::string commandline_commands;
|
||||
std::string currentdir;
|
||||
|
@ -77,7 +78,7 @@ int main(int argc, char **argv)
|
|||
QApplication app(argc, argv, false);
|
||||
fs::path original_path = fs::current_path();
|
||||
|
||||
currentdir = fs::current_path().generic_string();
|
||||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QApplication::instance()->applicationDirPath().toStdString());
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
#include "boosty.h"
|
||||
|
||||
std::string commandline_commands;
|
||||
std::string currentdir;
|
||||
|
@ -83,7 +84,7 @@ int main(int argc, char **argv)
|
|||
QApplication app(argc, argv, false);
|
||||
fs::path original_path = fs::current_path();
|
||||
|
||||
currentdir = fs::current_path().generic_string();
|
||||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QApplication::instance()->applicationDirPath().toStdString());
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
#include "boosty.h"
|
||||
|
||||
std::string commandline_commands;
|
||||
std::string currentdir;
|
||||
|
@ -85,7 +86,7 @@ int main(int argc, char **argv)
|
|||
QApplication app(argc, argv, false);
|
||||
fs::path original_path = fs::current_path();
|
||||
|
||||
currentdir = fs::current_path().generic_string();
|
||||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QApplication::instance()->applicationDirPath().toStdString());
|
||||
|
||||
|
|
Loading…
Reference in New Issue