Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' into lion

  • Loading branch information...
commit f3dcc208b7e0fd1ad6c08c26060ec7397769b9d2 2 parents e059146 + 13d56f4
@kintel kintel authored
View
8 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;
View
7 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=false)
{
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();
View
2  src/csgterm.h
@@ -59,7 +59,7 @@ class CSGChain
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);
BoundingBox getBoundingBox() const;
};
View
14 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;
}
View
4 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();
}
View
3  testdata/scad/templates/use-tests-template.scad
@@ -1,3 +1,6 @@
+//Test blank
+use <>
+
//Test that the entire path is pushed onto the stack upto the last '/'
use <sub1/sub2/sub3/sub4/use-test2.scad>
Please sign in to comment.
Something went wrong with that request. Please try again.