summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2012-08-19 18:08:32 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2012-08-19 18:08:32 (GMT)
commitc6eeb1a1c5da072e1c0a77d30892e4ee95ed9bde (patch)
treee5513fae2b6fbef7e974771eeb6deeba6e34f2a6 /src
parentee26d60a8b274afcdad7538bd8b2e9fb8d53f8bd (diff)
parentc1d5e82b4365bf9d0563e1c5927a99d3def91832 (diff)
Merge branch 'master' of github.com:openscad/openscad
Diffstat (limited to 'src')
-rw-r--r--src/AboutDialog.h2
-rw-r--r--src/CGALEvaluator.cc8
-rw-r--r--src/csgterm.cc7
-rw-r--r--src/csgterm.h2
-rw-r--r--src/dxfdata.cc3
-rw-r--r--src/lexer.l14
-rw-r--r--src/parsersettings.cc8
-rw-r--r--src/value.cc3
8 files changed, 32 insertions, 15 deletions
diff --git a/src/AboutDialog.h b/src/AboutDialog.h
index 529d8b4..34122a0 100644
--- a/src/AboutDialog.h
+++ b/src/AboutDialog.h
@@ -7,7 +7,7 @@ class AboutDialog : public QDialog, public Ui::AboutDialog
{
Q_OBJECT;
public:
- AboutDialog(QWidget *parent) {
+ AboutDialog(QWidget *) {
setupUi(this);
this->aboutText->setOpenExternalLinks(true);
QUrl flattr_qurl(":icons/flattr.png" );
diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc
index 1b307be..ee04e05 100644
--- a/src/CGALEvaluator.cc
+++ b/src/CGALEvaluator.cc
@@ -34,8 +34,8 @@
#include <assert.h>
#include <boost/foreach.hpp>
-#include <boost/unordered_map.hpp>
#include <boost/bind.hpp>
+#include <map>
CGAL_Nef_polyhedron CGALEvaluator::evaluateCGALMesh(const AbstractNode &node)
{
@@ -445,9 +445,9 @@ CGAL_Nef_polyhedron CGALEvaluator::evaluateCGALMesh(const PolySet &ps)
struct PolyReducer
{
Grid2d<int> grid;
- boost::unordered_map<std::pair<int,int>, std::pair<int,int> > edge_to_poly;
- boost::unordered_map<int, CGAL_Nef_polyhedron2::Point> points;
- typedef boost::unordered_map<int, std::vector<int> > PolygonMap;
+ std::map<std::pair<int,int>, std::pair<int,int> > edge_to_poly;
+ std::map<int, CGAL_Nef_polyhedron2::Point> points;
+ typedef std::map<int, std::vector<int> > PolygonMap;
PolygonMap polygons;
int poly_n;
diff --git a/src/csgterm.cc b/src/csgterm.cc
index 4e6912b..0e68320 100644
--- a/src/csgterm.cc
+++ b/src/csgterm.cc
@@ -178,7 +178,7 @@ void CSGChain::import(shared_ptr<CSGTerm> term, CSGTerm::type_e type)
}
}
-std::string CSGChain::dump()
+std::string CSGChain::dump(bool full)
{
std::stringstream dump;
@@ -193,6 +193,11 @@ std::string CSGChain::dump()
else if (types[i] == CSGTerm::TYPE_INTERSECTION)
dump << " *";
dump << labels[i];
+ if (full) {
+ dump << " polyset: \n" << polysets[i]->dump() << "\n";
+ dump << " matrix: \n" << matrices[i].matrix() << "\n";
+ dump << " color: \n" << colors[i] << "\n";
+ }
}
dump << "\n";
return dump.str();
diff --git a/src/csgterm.h b/src/csgterm.h
index 4278d85..566ebc3 100644
--- a/src/csgterm.h
+++ b/src/csgterm.h
@@ -59,7 +59,7 @@ public:
void add(const shared_ptr<PolySet> &polyset, const Transform3d &m, const Color4f &color, CSGTerm::type_e type, std::string label);
void import(shared_ptr<CSGTerm> term, CSGTerm::type_e type = CSGTerm::TYPE_UNION);
- std::string dump();
+ std::string dump(bool full = false);
BoundingBox getBoundingBox() const;
};
diff --git a/src/dxfdata.cc b/src/dxfdata.cc
index 4b542d1..4258a4c 100644
--- a/src/dxfdata.cc
+++ b/src/dxfdata.cc
@@ -39,6 +39,7 @@
#include <boost/algorithm/string.hpp>
#include <algorithm>
#include <sstream>
+#include <map>
#include <QDir>
#include "value.h"
@@ -397,7 +398,7 @@ DxfData::DxfData(double fn, double fs, double fa,
// Extract paths from parsed data
- typedef boost::unordered_map<int, int> LineMap;
+ typedef std::map<int, int> LineMap;
LineMap enabled_lines;
for (size_t i = 0; i < lines.size(); i++) {
enabled_lines[i] = i;
diff --git a/src/lexer.l b/src/lexer.l
index f939330..1e3bd5b 100644
--- a/src/lexer.l
+++ b/src/lexer.l
@@ -122,10 +122,16 @@ use[ \t\r\n>]*"<" { BEGIN(cond_use); }
}
}
/* Only accept regular files which exists */
- if (usepath.has_parent_path() && fs::exists(usepath)) {
+ if (usepath.has_parent_path() && fs::exists(usepath) && !fs::is_directory(usepath)) {
handle_dep(usepath.string());
parserlval.text = strdup(usepath.string().c_str());
return TOK_USE;
+ } else {
+ PRINTB("WARNING: Can't open 'use' file '%s'.", filename);
+ if ( filename.size() == 0 )
+ PRINT("WARNING: 'use' filename is blank");
+ else if ( fs::is_directory( usepath ) )
+ PRINTB("WARNING: 'use' file points to a directory: %s",filename);
}
}
}
@@ -217,6 +223,10 @@ void includefile()
finfo = locate_file((fs::path(filepath) / filename).string());
}
+ if (finfo.empty()) {
+ PRINTB("WARNING: Can't find 'include' file '%s'.", filename);
+ }
+
filepath.clear();
path_stack.push_back(finfo.parent_path());
@@ -225,7 +235,7 @@ void includefile()
currmodule->registerInclude(fullname);
yyin = fopen(fullname.c_str(), "r");
if (!yyin) {
- PRINTB("WARNING: Can't open input file '%s'.", filename);
+ PRINTB("WARNING: Can't open 'include' file '%s'.", filename);
path_stack.pop_back();
return;
}
diff --git a/src/parsersettings.cc b/src/parsersettings.cc
index 53b34f4..47859c7 100644
--- a/src/parsersettings.cc
+++ b/src/parsersettings.cc
@@ -15,13 +15,13 @@ void add_librarydir(const std::string &libdir)
/*!
Searces for the given file in library paths and returns the full path if found.
- Returns an empty path if file cannot be found.
+ Returns an empty path if file cannot be found or filename is a directory.
*/
std::string locate_file(const std::string &filename)
{
BOOST_FOREACH(const std::string &dir, librarypath) {
fs::path usepath = fs::path(dir) / filename;
- if (fs::exists(usepath)) return usepath.string();
+ if (fs::exists(usepath) && !fs::is_directory(usepath)) return usepath.string();
}
return std::string();
}
@@ -33,10 +33,10 @@ void parser_init(const std::string &applicationpath)
std::string librarydir;
fs::path libdir(applicationpath);
fs::path tmpdir;
-#ifdef Q_WS_MAC
+#ifdef __APPLE__
libdir /= "../Resources"; // Libraries can be bundled
if (!is_directory(libdir / "libraries")) libdir /= "../../..";
-#elif defined(Q_OS_UNIX)
+#elif !defined(WIN32)
if (is_directory(tmpdir = libdir / "../share/openscad/libraries")) {
librarydir = boosty::stringy( tmpdir );
} else if (is_directory(tmpdir = libdir / "../../share/openscad/libraries")) {
diff --git a/src/value.cc b/src/value.cc
index 3b7f357..7744a18 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -25,8 +25,9 @@
*/
#include "value.h"
+#include <stdio.h>
#include <math.h>
-#include <assert.h> // fmod
+#include <assert.h>
#include <sstream>
#include <boost/foreach.hpp>
#include <boost/variant/apply_visitor.hpp>
contact: Jan Huwald // Impressum