From 130e10778e9d74ceb07dfc813b85d75a52a71e10 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Mon, 11 Feb 2013 23:33:31 -0500 Subject: Initial code to support scaling of linear_extrude(). Part of Issue #273 diff --git a/src/CGALRenderer.cc b/src/CGALRenderer.cc index 4357e44..aadc2b4 100644 --- a/src/CGALRenderer.cc +++ b/src/CGALRenderer.cc @@ -52,7 +52,7 @@ CGALRenderer::CGALRenderer(const CGAL_Nef_polyhedron &root) : root(root) this->polyhedron = NULL; this->polyset = new PolySet(); this->polyset->is2d = true; - dxf_tesselate(this->polyset, *dd, 0, true, false, 0); + dxf_tesselate(this->polyset, *dd, 0, 1, true, false, 0); delete dd; } else if (root.dim == 3) { diff --git a/src/CGAL_Nef_polyhedron.cc b/src/CGAL_Nef_polyhedron.cc index 8906595..d9cd174 100644 --- a/src/CGAL_Nef_polyhedron.cc +++ b/src/CGAL_Nef_polyhedron.cc @@ -90,7 +90,7 @@ PolySet *CGAL_Nef_polyhedron::convertToPolyset() ps = new PolySet(); DxfData *dd = this->convertToDxfData(); ps->is2d = true; - dxf_tesselate(ps, *dd, 0, true, false, 0); + dxf_tesselate(ps, *dd, 0, 1, true, false, 0); dxf_border_to_ps(ps, *dd); delete dd; } diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc index 5976daf..6d0704e 100644 --- a/src/PolySetCGALEvaluator.cc +++ b/src/PolySetCGALEvaluator.cc @@ -202,27 +202,37 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node) return ps; } -static void add_slice(PolySet *ps, const DxfData &dxf, DxfData::Path &path, double rot1, double rot2, double h1, double h2) +static void add_slice(PolySet *ps, const DxfData &dxf, DxfData::Path &path, + double rot1, double rot2, + double h1, double h2, + double scale1, double scale2) { + // FIXME: If scale2 == 0 we need to handle tessellation separately bool splitfirst = sin(rot2 - rot1) >= 0.0; - for (size_t j = 1; j < path.indices.size(); j++) - { + for (size_t j = 1; j < path.indices.size(); j++) { int k = j - 1; - double jx1 = dxf.points[path.indices[j]][0] * cos(rot1*M_PI/180) + dxf.points[path.indices[j]][1] * sin(rot1*M_PI/180); - double jy1 = dxf.points[path.indices[j]][0] * -sin(rot1*M_PI/180) + dxf.points[path.indices[j]][1] * cos(rot1*M_PI/180); + double jx1 = scale1 * (dxf.points[path.indices[j]][0] * cos(rot1*M_PI/180) + + dxf.points[path.indices[j]][1] * sin(rot1*M_PI/180)); + double jy1 = scale1 * (dxf.points[path.indices[j]][0] * -sin(rot1*M_PI/180) + + dxf.points[path.indices[j]][1] * cos(rot1*M_PI/180)); - double jx2 = dxf.points[path.indices[j]][0] * cos(rot2*M_PI/180) + dxf.points[path.indices[j]][1] * sin(rot2*M_PI/180); - double jy2 = dxf.points[path.indices[j]][0] * -sin(rot2*M_PI/180) + dxf.points[path.indices[j]][1] * cos(rot2*M_PI/180); + double jx2 = scale2 * (dxf.points[path.indices[j]][0] * cos(rot2*M_PI/180) + + dxf.points[path.indices[j]][1] * sin(rot2*M_PI/180)); + double jy2 = scale2 * (dxf.points[path.indices[j]][0] * -sin(rot2*M_PI/180) + + dxf.points[path.indices[j]][1] * cos(rot2*M_PI/180)); - double kx1 = dxf.points[path.indices[k]][0] * cos(rot1*M_PI/180) + dxf.points[path.indices[k]][1] * sin(rot1*M_PI/180); - double ky1 = dxf.points[path.indices[k]][0] * -sin(rot1*M_PI/180) + dxf.points[path.indices[k]][1] * cos(rot1*M_PI/180); + double kx1 = scale1 * (dxf.points[path.indices[k]][0] * cos(rot1*M_PI/180) + + dxf.points[path.indices[k]][1] * sin(rot1*M_PI/180)); + double ky1 = scale1 * (dxf.points[path.indices[k]][0] * -sin(rot1*M_PI/180) + + dxf.points[path.indices[k]][1] * cos(rot1*M_PI/180)); - double kx2 = dxf.points[path.indices[k]][0] * cos(rot2*M_PI/180) + dxf.points[path.indices[k]][1] * sin(rot2*M_PI/180); - double ky2 = dxf.points[path.indices[k]][0] * -sin(rot2*M_PI/180) + dxf.points[path.indices[k]][1] * cos(rot2*M_PI/180); + double kx2 = scale2 * (dxf.points[path.indices[k]][0] * cos(rot2*M_PI/180) + + dxf.points[path.indices[k]][1] * sin(rot2*M_PI/180)); + double ky2 = scale2 * (dxf.points[path.indices[k]][0] * -sin(rot2*M_PI/180) + + dxf.points[path.indices[k]][1] * cos(rot2*M_PI/180)); - if (splitfirst) - { + if (splitfirst) { ps->append_poly(); if (path.is_inner) { ps->append_vertex(kx1, ky1, h1); @@ -234,19 +244,20 @@ static void add_slice(PolySet *ps, const DxfData &dxf, DxfData::Path &path, doub ps->insert_vertex(jx2, jy2, h2); } - ps->append_poly(); - if (path.is_inner) { - ps->append_vertex(kx2, ky2, h2); - ps->append_vertex(kx1, ky1, h1); - ps->append_vertex(jx2, jy2, h2); - } else { - ps->insert_vertex(kx2, ky2, h2); - ps->insert_vertex(kx1, ky1, h1); - ps->insert_vertex(jx2, jy2, h2); + if (scale2 > 0) { + ps->append_poly(); + if (path.is_inner) { + ps->append_vertex(kx2, ky2, h2); + ps->append_vertex(kx1, ky1, h1); + ps->append_vertex(jx2, jy2, h2); + } else { + ps->insert_vertex(kx2, ky2, h2); + ps->insert_vertex(kx1, ky1, h1); + ps->insert_vertex(jx2, jy2, h2); + } } } - else - { + else { ps->append_poly(); if (path.is_inner) { ps->append_vertex(kx1, ky1, h1); @@ -258,15 +269,17 @@ static void add_slice(PolySet *ps, const DxfData &dxf, DxfData::Path &path, doub ps->insert_vertex(kx2, ky2, h2); } - ps->append_poly(); - if (path.is_inner) { - ps->append_vertex(jx2, jy2, h2); - ps->append_vertex(kx2, ky2, h2); - ps->append_vertex(jx1, jy1, h1); - } else { - ps->insert_vertex(jx2, jy2, h2); - ps->insert_vertex(kx2, ky2, h2); - ps->insert_vertex(jx1, jy1, h1); + if (scale2 > 0) { + ps->append_poly(); + if (path.is_inner) { + ps->append_vertex(jx2, jy2, h2); + ps->append_vertex(kx2, ky2, h2); + ps->append_vertex(jx1, jy1, h1); + } else { + ps->insert_vertex(jx2, jy2, h2); + ps->insert_vertex(kx2, ky2, h2); + ps->insert_vertex(jx1, jy1, h1); + } } } } @@ -322,10 +335,8 @@ PolySet *PolySetCGALEvaluator::extrudeDxfData(const LinearExtrudeNode &node, Dxf } bool first_open_path = true; - for (size_t i = 0; i < dxf.paths.size(); i++) - { - if (dxf.paths[i].is_closed) - continue; + for (size_t i = 0; i < dxf.paths.size(); i++) { + if (dxf.paths[i].is_closed) continue; if (first_open_path) { PRINTB("WARNING: Open paths in dxf_linear_extrude(file = \"%s\", layer = \"%s\"):", node.filename % node.layername); @@ -339,33 +350,32 @@ PolySet *PolySetCGALEvaluator::extrudeDxfData(const LinearExtrudeNode &node, Dxf } - if (node.has_twist) - { - dxf_tesselate(ps, dxf, 0, false, true, h1); - dxf_tesselate(ps, dxf, node.twist, true, true, h2); - for (int j = 0; j < node.slices; j++) - { + if (node.has_twist) { + dxf_tesselate(ps, dxf, 0, 1, false, true, h1); + if (node.scale > 0) { + dxf_tesselate(ps, dxf, node.twist, node.scale, true, true, h2); + } + for (int j = 0; j < node.slices; j++) { double t1 = node.twist*j / node.slices; double t2 = node.twist*(j+1) / node.slices; double g1 = h1 + (h2-h1)*j / node.slices; double g2 = h1 + (h2-h1)*(j+1) / node.slices; - for (size_t i = 0; i < dxf.paths.size(); i++) - { - if (!dxf.paths[i].is_closed) - continue; - add_slice(ps, dxf, dxf.paths[i], t1, t2, g1, g2); + double s1 = 1 - (1-node.scale)*j / node.slices; + double s2 = 1 - (1-node.scale)*(j+1) / node.slices; + for (size_t i = 0; i < dxf.paths.size(); i++) { + if (!dxf.paths[i].is_closed) continue; + add_slice(ps, dxf, dxf.paths[i], t1, t2, g1, g2, s1, s2); } } } - else - { - dxf_tesselate(ps, dxf, 0, false, true, h1); - dxf_tesselate(ps, dxf, 0, true, true, h2); - for (size_t i = 0; i < dxf.paths.size(); i++) - { - if (!dxf.paths[i].is_closed) - continue; - add_slice(ps, dxf, dxf.paths[i], 0, 0, h1, h2); + else { + dxf_tesselate(ps, dxf, 0, 1, false, true, h1); + if (node.scale > 0) { + dxf_tesselate(ps, dxf, 0, node.scale, true, true, h2); + } + for (size_t i = 0; i < dxf.paths.size(); i++) { + if (!dxf.paths[i].is_closed) continue; + add_slice(ps, dxf, dxf.paths[i], 0, 0, h1, h2, 1, node.scale); } } diff --git a/src/dxftess-cgal.cc b/src/dxftess-cgal.cc index 0197473..fffa4f1 100644 --- a/src/dxftess-cgal.cc +++ b/src/dxftess-cgal.cc @@ -101,7 +101,7 @@ void mark_inner_outer(std::vector &tri, Grid2d &p } } -void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool /* do_triangle_splitting */, double h) +void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, double scale, bool up, bool /* do_triangle_splitting */, double h) { CDT cdt; @@ -124,8 +124,8 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool /* do_tr struct point_info_t *first_pi = NULL, *prev_pi = NULL; for (size_t j = 1; j < dxf.paths[i].indices.size(); j++) { - double x = dxf.points[dxf.paths[i].indices[j]][0]; - double y = dxf.points[dxf.paths[i].indices[j]][1]; + double x = scale * dxf.points[dxf.paths[i].indices[j]][0]; + double y = scale * dxf.points[dxf.paths[i].indices[j]][1]; if (point_info.has(x, y)) { // FIXME: How can the same path set contain the same point twice? diff --git a/src/dxftess-glu.cc b/src/dxftess-glu.cc index 3f87729..38b09e9 100644 --- a/src/dxftess-glu.cc +++ b/src/dxftess-glu.cc @@ -201,7 +201,7 @@ inline void do_emplace( boost::unordered_multimap &tri_by_atan2, i rot: CLOCKWISE rotation around positive Z axis */ -void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool do_triangle_splitting, double h) +void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, double scale, bool up, bool do_triangle_splitting, double h) { GLUtesselator *tobj = gluNewTess(); @@ -244,8 +244,8 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool do_trian dxf.points[dxf.paths[i].indices[j]][1], h) = std::pair(i, j); vl.push_back(tess_vdata()); - vl.back().v[0] = dxf.points[dxf.paths[i].indices[j]][0]; - vl.back().v[1] = dxf.points[dxf.paths[i].indices[j]][1]; + vl.back().v[0] = scale * dxf.points[dxf.paths[i].indices[j]][0]; + vl.back().v[1] = scale * dxf.points[dxf.paths[i].indices[j]][1]; vl.back().v[2] = h; gluTessVertex(tobj, vl.back().v, vl.back().v); } diff --git a/src/dxftess.h b/src/dxftess.h index d3af36e..92c85ea 100644 --- a/src/dxftess.h +++ b/src/dxftess.h @@ -3,7 +3,7 @@ class DxfData; class PolySet; -void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool do_triangle_splitting, double h); +void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, double scale, bool up, bool do_triangle_splitting, double h); void dxf_border_to_ps(PolySet *ps, const DxfData &dxf); #endif diff --git a/src/import.cc b/src/import.cc index bb44d70..bf21780 100644 --- a/src/import.cc +++ b/src/import.cc @@ -294,7 +294,7 @@ PolySet *ImportNode::evaluate_polyset(class PolySetEvaluator *) const p = new PolySet(); DxfData dd(this->fn, this->fs, this->fa, this->filename, this->layername, this->origin_x, this->origin_y, this->scale); p->is2d = true; - dxf_tesselate(p, dd, 0, true, false, 0); + dxf_tesselate(p, dd, 0, 1, true, false, 0); dxf_border_to_ps(p, dd); } else diff --git a/src/linearextrude.cc b/src/linearextrude.cc index bc678e6..89e92ba 100644 --- a/src/linearextrude.cc +++ b/src/linearextrude.cc @@ -91,7 +91,7 @@ AbstractNode *LinearExtrudeModule::instantiate(const Context *ctx, const ModuleI node->height = height.toDouble(); node->convexity = (int)convexity.toDouble(); origin.getVec2(node->origin_x, node->origin_y); - node->scale = scale.toDouble(); + node->scale = scale.isUndefined() ? 1 : scale.toDouble(); if (center.type() == Value::BOOL) node->center = center.toBool(); @@ -102,8 +102,8 @@ AbstractNode *LinearExtrudeModule::instantiate(const Context *ctx, const ModuleI if (node->convexity <= 0) node->convexity = 1; - if (node->scale <= 0) - node->scale = 1; + if (node->scale < 0) + node->scale = 0; if (twist.type() == Value::NUMBER) { node->twist = twist.toDouble(); @@ -166,6 +166,7 @@ std::string LinearExtrudeNode::toString() const if (this->has_twist) { stream << ", twist = " << this->twist << ", slices = " << this->slices; } + stream << ", scale = " << this->scale; stream << ", $fn = " << this->fn << ", $fa = " << this->fa << ", $fs = " << this->fs << ")"; return stream.str(); diff --git a/src/primitives.cc b/src/primitives.cc index be1ec6f..3298073 100644 --- a/src/primitives.cc +++ b/src/primitives.cc @@ -546,7 +546,7 @@ sphere_next_r2: p->is2d = true; p->convexity = convexity; - dxf_tesselate(p, dd, 0, true, false, 0); + dxf_tesselate(p, dd, 0, 1, true, false, 0); dxf_border_to_ps(p, dd); } -- cgit v0.10.1 From adffb9121fbf5d12542ae0d8c5a010e78cc8a4f9 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Fri, 10 May 2013 18:01:50 +0200 Subject: Added support for 2D scaling in linear_extrude diff --git a/src/CGALRenderer.cc b/src/CGALRenderer.cc index aadc2b4..0a75266 100644 --- a/src/CGALRenderer.cc +++ b/src/CGALRenderer.cc @@ -52,7 +52,7 @@ CGALRenderer::CGALRenderer(const CGAL_Nef_polyhedron &root) : root(root) this->polyhedron = NULL; this->polyset = new PolySet(); this->polyset->is2d = true; - dxf_tesselate(this->polyset, *dd, 0, 1, true, false, 0); + dxf_tesselate(this->polyset, *dd, 0, Vector2d(1,1), true, false, 0); delete dd; } else if (root.dim == 3) { diff --git a/src/CGAL_Nef_polyhedron.cc b/src/CGAL_Nef_polyhedron.cc index d9cd174..440f4ed 100644 --- a/src/CGAL_Nef_polyhedron.cc +++ b/src/CGAL_Nef_polyhedron.cc @@ -90,7 +90,7 @@ PolySet *CGAL_Nef_polyhedron::convertToPolyset() ps = new PolySet(); DxfData *dd = this->convertToDxfData(); ps->is2d = true; - dxf_tesselate(ps, *dd, 0, 1, true, false, 0); + dxf_tesselate(ps, *dd, 0, Vector2d(1,1), true, false, 0); dxf_border_to_ps(ps, *dd); delete dd; } diff --git a/src/CGAL_Nef_polyhedron_DxfData.cc b/src/CGAL_Nef_polyhedron_DxfData.cc index 0388fe5..c4347e8 100644 --- a/src/CGAL_Nef_polyhedron_DxfData.cc +++ b/src/CGAL_Nef_polyhedron_DxfData.cc @@ -123,7 +123,7 @@ void CGAL_Nef_polyhedron::transform( const Transform3d &matrix ) PolySet ps; ps.is2d = true; - dxf_tesselate(&ps, *dd, 0, true, false, 0); + dxf_tesselate(&ps, *dd, 0, Vector2d(1,1), true, false, 0); Tree nulltree; CGALEvaluator tmpeval(nulltree); diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc index 6d0704e..f0c274f 100644 --- a/src/PolySetCGALEvaluator.cc +++ b/src/PolySetCGALEvaluator.cc @@ -205,31 +205,32 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node) static void add_slice(PolySet *ps, const DxfData &dxf, DxfData::Path &path, double rot1, double rot2, double h1, double h2, - double scale1, double scale2) + double scale1_x, double scale1_y, + double scale2_x, double scale2_y) { // FIXME: If scale2 == 0 we need to handle tessellation separately bool splitfirst = sin(rot2 - rot1) >= 0.0; for (size_t j = 1; j < path.indices.size(); j++) { int k = j - 1; - double jx1 = scale1 * (dxf.points[path.indices[j]][0] * cos(rot1*M_PI/180) + + double jx1 = scale1_x * (dxf.points[path.indices[j]][0] * cos(rot1*M_PI/180) + dxf.points[path.indices[j]][1] * sin(rot1*M_PI/180)); - double jy1 = scale1 * (dxf.points[path.indices[j]][0] * -sin(rot1*M_PI/180) + + double jy1 = scale1_y * (dxf.points[path.indices[j]][0] * -sin(rot1*M_PI/180) + dxf.points[path.indices[j]][1] * cos(rot1*M_PI/180)); - double jx2 = scale2 * (dxf.points[path.indices[j]][0] * cos(rot2*M_PI/180) + + double jx2 = scale2_x * (dxf.points[path.indices[j]][0] * cos(rot2*M_PI/180) + dxf.points[path.indices[j]][1] * sin(rot2*M_PI/180)); - double jy2 = scale2 * (dxf.points[path.indices[j]][0] * -sin(rot2*M_PI/180) + + double jy2 = scale2_y * (dxf.points[path.indices[j]][0] * -sin(rot2*M_PI/180) + dxf.points[path.indices[j]][1] * cos(rot2*M_PI/180)); - double kx1 = scale1 * (dxf.points[path.indices[k]][0] * cos(rot1*M_PI/180) + + double kx1 = scale1_x * (dxf.points[path.indices[k]][0] * cos(rot1*M_PI/180) + dxf.points[path.indices[k]][1] * sin(rot1*M_PI/180)); - double ky1 = scale1 * (dxf.points[path.indices[k]][0] * -sin(rot1*M_PI/180) + + double ky1 = scale1_y * (dxf.points[path.indices[k]][0] * -sin(rot1*M_PI/180) + dxf.points[path.indices[k]][1] * cos(rot1*M_PI/180)); - double kx2 = scale2 * (dxf.points[path.indices[k]][0] * cos(rot2*M_PI/180) + + double kx2 = scale2_x * (dxf.points[path.indices[k]][0] * cos(rot2*M_PI/180) + dxf.points[path.indices[k]][1] * sin(rot2*M_PI/180)); - double ky2 = scale2 * (dxf.points[path.indices[k]][0] * -sin(rot2*M_PI/180) + + double ky2 = scale2_y * (dxf.points[path.indices[k]][0] * -sin(rot2*M_PI/180) + dxf.points[path.indices[k]][1] * cos(rot2*M_PI/180)); if (splitfirst) { @@ -244,7 +245,7 @@ static void add_slice(PolySet *ps, const DxfData &dxf, DxfData::Path &path, ps->insert_vertex(jx2, jy2, h2); } - if (scale2 > 0) { + if (scale2_x > 0 || scale2_y > 0) { ps->append_poly(); if (path.is_inner) { ps->append_vertex(kx2, ky2, h2); @@ -269,7 +270,7 @@ static void add_slice(PolySet *ps, const DxfData &dxf, DxfData::Path &path, ps->insert_vertex(kx2, ky2, h2); } - if (scale2 > 0) { + if (scale2_x > 0 || scale2_y > 0) { ps->append_poly(); if (path.is_inner) { ps->append_vertex(jx2, jy2, h2); @@ -311,7 +312,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const LinearExtrudeNode &node) if (sum.isNull()) return NULL; dxf = sum.convertToDxfData();; } else { - dxf = new DxfData(node.fn, node.fs, node.fa, node.filename, node.layername, node.origin_x, node.origin_y, node.scale); + dxf = new DxfData(node.fn, node.fs, node.fa, node.filename, node.layername, node.origin_x, node.origin_y, node.scale_x); } PolySet *ps = extrudeDxfData(node, *dxf); @@ -343,39 +344,41 @@ PolySet *PolySetCGALEvaluator::extrudeDxfData(const LinearExtrudeNode &node, Dxf first_open_path = false; } PRINTB(" %9.5f %10.5f ... %10.5f %10.5f", - (dxf.points[dxf.paths[i].indices.front()][0] / node.scale + node.origin_x) % - (dxf.points[dxf.paths[i].indices.front()][1] / node.scale + node.origin_y) % - (dxf.points[dxf.paths[i].indices.back()][0] / node.scale + node.origin_x) % - (dxf.points[dxf.paths[i].indices.back()][1] / node.scale + node.origin_y)); + (dxf.points[dxf.paths[i].indices.front()][0] / node.scale_x + node.origin_x) % + (dxf.points[dxf.paths[i].indices.front()][1] / node.scale_y + node.origin_y) % + (dxf.points[dxf.paths[i].indices.back()][0] / node.scale_x + node.origin_x) % + (dxf.points[dxf.paths[i].indices.back()][1] / node.scale_y + node.origin_y)); } if (node.has_twist) { - dxf_tesselate(ps, dxf, 0, 1, false, true, h1); - if (node.scale > 0) { - dxf_tesselate(ps, dxf, node.twist, node.scale, true, true, h2); + dxf_tesselate(ps, dxf, 0, Vector2d(1,1), false, true, h1); // bottom + if (node.scale_x > 0 || node.scale_y > 0) { + dxf_tesselate(ps, dxf, node.twist, Vector2d(node.scale_x, node.scale_y), true, true, h2); // top } for (int j = 0; j < node.slices; j++) { double t1 = node.twist*j / node.slices; double t2 = node.twist*(j+1) / node.slices; double g1 = h1 + (h2-h1)*j / node.slices; double g2 = h1 + (h2-h1)*(j+1) / node.slices; - double s1 = 1 - (1-node.scale)*j / node.slices; - double s2 = 1 - (1-node.scale)*(j+1) / node.slices; + double s1x = 1 - (1-node.scale_x)*j / node.slices; + double s1y = 1 - (1-node.scale_y)*j / node.slices; + double s2x = 1 - (1-node.scale_x)*(j+1) / node.slices; + double s2y = 1 - (1-node.scale_y)*(j+1) / node.slices; for (size_t i = 0; i < dxf.paths.size(); i++) { if (!dxf.paths[i].is_closed) continue; - add_slice(ps, dxf, dxf.paths[i], t1, t2, g1, g2, s1, s2); + add_slice(ps, dxf, dxf.paths[i], t1, t2, g1, g2, s1x, s1y, s2x, s2y); } } } else { - dxf_tesselate(ps, dxf, 0, 1, false, true, h1); - if (node.scale > 0) { - dxf_tesselate(ps, dxf, 0, node.scale, true, true, h2); + dxf_tesselate(ps, dxf, 0, Vector2d(1,1), false, true, h1); //bottom + if (node.scale_x > 0 || node.scale_y > 0) { + dxf_tesselate(ps, dxf, 0, Vector2d(node.scale_x, node.scale_y), true, true, h2); // top } for (size_t i = 0; i < dxf.paths.size(); i++) { if (!dxf.paths[i].is_closed) continue; - add_slice(ps, dxf, dxf.paths[i], 0, 0, h1, h2, 1, node.scale); + add_slice(ps, dxf, dxf.paths[i], 0, 0, h1, h2, 1, 1, node.scale_x, node.scale_y); } } diff --git a/src/dxftess-cgal.cc b/src/dxftess-cgal.cc index fffa4f1..16eaf9f 100644 --- a/src/dxftess-cgal.cc +++ b/src/dxftess-cgal.cc @@ -101,7 +101,7 @@ void mark_inner_outer(std::vector &tri, Grid2d &p } } -void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, double scale, bool up, bool /* do_triangle_splitting */, double h) +void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, Vector2d scale, bool up, bool /* do_triangle_splitting */, double h) { CDT cdt; @@ -124,8 +124,8 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, double scale, bool up, struct point_info_t *first_pi = NULL, *prev_pi = NULL; for (size_t j = 1; j < dxf.paths[i].indices.size(); j++) { - double x = scale * dxf.points[dxf.paths[i].indices[j]][0]; - double y = scale * dxf.points[dxf.paths[i].indices[j]][1]; + double x = dxf.points[dxf.paths[i].indices[j]][0]; + double y = dxf.points[dxf.paths[i].indices[j]][1]; if (point_info.has(x, y)) { // FIXME: How can the same path set contain the same point twice? @@ -314,8 +314,8 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, double scale, bool up, int idx = up ? j : (2-j); double px = tri[i].p[idx].x; double py = tri[i].p[idx].y; - ps->append_vertex(px * cos(rot*M_PI/180) + py * sin(rot*M_PI/180), - px * -sin(rot*M_PI/180) + py * cos(rot*M_PI/180), h); + ps->append_vertex(scale[0] * (px * cos(rot*M_PI/180) + py * sin(rot*M_PI/180)), + scale[1] * (px * -sin(rot*M_PI/180) + py * cos(rot*M_PI/180)), h); path[j] = point_info.data(px, py).pathidx; point[j] = point_info.data(px, py).pointidx; } diff --git a/src/dxftess-glu.cc b/src/dxftess-glu.cc index 38b09e9..89999c3 100644 --- a/src/dxftess-glu.cc +++ b/src/dxftess-glu.cc @@ -201,7 +201,7 @@ inline void do_emplace( boost::unordered_multimap &tri_by_atan2, i rot: CLOCKWISE rotation around positive Z axis */ -void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, double scale, bool up, bool do_triangle_splitting, double h) +void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, Vector2d scale, bool up, bool do_triangle_splitting, double h) { GLUtesselator *tobj = gluNewTess(); @@ -244,8 +244,8 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, double scale, bool up, dxf.points[dxf.paths[i].indices[j]][1], h) = std::pair(i, j); vl.push_back(tess_vdata()); - vl.back().v[0] = scale * dxf.points[dxf.paths[i].indices[j]][0]; - vl.back().v[1] = scale * dxf.points[dxf.paths[i].indices[j]][1]; + vl.back().v[0] = scale[0] * dxf.points[dxf.paths[i].indices[j]][0]; + vl.back().v[1] = scale[1] * dxf.points[dxf.paths[i].indices[j]][1]; vl.back().v[2] = h; gluTessVertex(tobj, vl.back().v, vl.back().v); } diff --git a/src/dxftess.h b/src/dxftess.h index 92c85ea..f0f27b5 100644 --- a/src/dxftess.h +++ b/src/dxftess.h @@ -1,9 +1,11 @@ #ifndef DXFTESS_H_ #define DXFTESS_H_ +#include "linalg.h" + class DxfData; class PolySet; -void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, double scale, bool up, bool do_triangle_splitting, double h); +void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, Vector2d scale, bool up, bool do_triangle_splitting, double h); void dxf_border_to_ps(PolySet *ps, const DxfData &dxf); #endif diff --git a/src/import.cc b/src/import.cc index bf21780..2180684 100644 --- a/src/import.cc +++ b/src/import.cc @@ -294,7 +294,7 @@ PolySet *ImportNode::evaluate_polyset(class PolySetEvaluator *) const p = new PolySet(); DxfData dd(this->fn, this->fs, this->fa, this->filename, this->layername, this->origin_x, this->origin_y, this->scale); p->is2d = true; - dxf_tesselate(p, dd, 0, 1, true, false, 0); + dxf_tesselate(p, dd, 0, Vector2d(1,1), true, false, 0); dxf_border_to_ps(p, dd); } else diff --git a/src/linearextrude.cc b/src/linearextrude.cc index 89e92ba..9a7365b 100644 --- a/src/linearextrude.cc +++ b/src/linearextrude.cc @@ -91,7 +91,10 @@ AbstractNode *LinearExtrudeModule::instantiate(const Context *ctx, const ModuleI node->height = height.toDouble(); node->convexity = (int)convexity.toDouble(); origin.getVec2(node->origin_x, node->origin_y); - node->scale = scale.isUndefined() ? 1 : scale.toDouble(); + node->scale_x = node->scale_y = 1; + scale.getDouble(node->scale_x); + scale.getDouble(node->scale_y); + scale.getVec2(node->scale_x, node->scale_y); if (center.type() == Value::BOOL) node->center = center.toBool(); @@ -102,8 +105,8 @@ AbstractNode *LinearExtrudeModule::instantiate(const Context *ctx, const ModuleI if (node->convexity <= 0) node->convexity = 1; - if (node->scale < 0) - node->scale = 0; + if (node->scale_x < 0) node->scale_x = 0; + if (node->scale_y < 0) node->scale_y = 0; if (twist.type() == Value::NUMBER) { node->twist = twist.toDouble(); @@ -151,7 +154,6 @@ std::string LinearExtrudeNode::toString() const "file = " << this->filename << ", " "layer = " << QuotedString(this->layername) << ", " "origin = [" << this->origin_x << ", " << this->origin_y << "], " - "scale = " << this->scale << ", " #ifndef OPENSCAD_TESTING // timestamp is needed for caching, but disturbs the test framework << "timestamp = " << (fs::exists(path) ? fs::last_write_time(path) : 0) << ", " @@ -166,7 +168,7 @@ std::string LinearExtrudeNode::toString() const if (this->has_twist) { stream << ", twist = " << this->twist << ", slices = " << this->slices; } - stream << ", scale = " << this->scale; + stream << ", scale = [" << this->scale_x << ", " << this->scale_y << "]"; stream << ", $fn = " << this->fn << ", $fa = " << this->fa << ", $fs = " << this->fs << ")"; return stream.str(); diff --git a/src/linearextrudenode.h b/src/linearextrudenode.h index 112eccc..6ff8c56 100644 --- a/src/linearextrudenode.h +++ b/src/linearextrudenode.h @@ -11,7 +11,8 @@ public: LinearExtrudeNode(const ModuleInstantiation *mi) : AbstractPolyNode(mi) { convexity = slices = 0; fn = fs = fa = height = twist = 0; - origin_x = origin_y = scale = 0; + origin_x = origin_y = 0; + scale_x = scale_y = 1; center = has_twist = false; } virtual Response accept(class State &state, Visitor &visitor) const { @@ -22,7 +23,7 @@ public: int convexity, slices; double fn, fs, fa, height, twist; - double origin_x, origin_y, scale; + double origin_x, origin_y, scale_x, scale_y; bool center, has_twist; Filename filename; std::string layername; diff --git a/src/primitives.cc b/src/primitives.cc index 3298073..9b755ef 100644 --- a/src/primitives.cc +++ b/src/primitives.cc @@ -546,7 +546,7 @@ sphere_next_r2: p->is2d = true; p->convexity = convexity; - dxf_tesselate(p, dd, 0, 1, true, false, 0); + dxf_tesselate(p, dd, 0, Vector2d(1,1), true, false, 0); dxf_border_to_ps(p, dd); } diff --git a/testdata/scad/features/linear_extrude-scale-tests.scad b/testdata/scad/features/linear_extrude-scale-tests.scad new file mode 100644 index 0000000..9a82c9d --- /dev/null +++ b/testdata/scad/features/linear_extrude-scale-tests.scad @@ -0,0 +1,17 @@ +difference() { + linear_extrude(height=40, scale=[0, 0]) { + square(10, center=true); + translate([10,0]) circle(10); + } + translate([0,0,35]) sphere(10); +} + +/* +Test case ideas: +o off-center starting point +o Concave polygon +o Disjoint polygons +o multi-rotation twist +o zero scales, zero scales in only one axis (for the above cases) +o boolean operations on scaled extrusion (including zero scale) +*/ -- cgit v0.10.1 From 8c532d525203d6cd0fc8ab200a4dea1dccd03dd6 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 11 May 2013 12:56:19 -0400 Subject: Updated test cases to reflect scale argument to linear_extrude (#273) diff --git a/tests/regression/dumptest/allmodules-expected.txt b/tests/regression/dumptest/allmodules-expected.txt index 86bb7fb..e6bd498 100644 --- a/tests/regression/dumptest/allmodules-expected.txt +++ b/tests/regression/dumptest/allmodules-expected.txt @@ -10,8 +10,8 @@ union(); difference(); intersection(); - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2); - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2); + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2); + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2); rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 2); rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 2); import(file = "", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); diff --git a/tests/regression/dumptest/dxf_linear_extrude-expected.txt b/tests/regression/dumptest/dxf_linear_extrude-expected.txt index ec46e66..9ad9e00 100644 --- a/tests/regression/dumptest/dxf_linear_extrude-expected.txt +++ b/tests/regression/dumptest/dxf_linear_extrude-expected.txt @@ -1,2 +1,2 @@ - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2); + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2); diff --git a/tests/regression/dumptest/example009-expected.txt b/tests/regression/dumptest/example009-expected.txt index b293224..b4c7bcf 100644 --- a/tests/regression/dumptest/example009-expected.txt +++ b/tests/regression/dumptest/example009-expected.txt @@ -1,20 +1,20 @@ - %linear_extrude(height = 22, center = true, convexity = 10, $fn = 0, $fa = 12, $fs = 2) { + %linear_extrude(height = 22, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { import(file = "example009.dxf", layer = "body", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); } %group() { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 12], [0, 0, 0, 1]]) { - linear_extrude(height = 2, center = true, convexity = 10, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 2, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { import(file = "example009.dxf", layer = "plate", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); } } multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -12], [0, 0, 0, 1]]) { - linear_extrude(height = 2, center = true, convexity = 10, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 2, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { import(file = "example009.dxf", layer = "plate", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); } } } intersection() { - linear_extrude(height = 20, center = true, convexity = 10, twist = -57.5288, slices = 4, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 20, center = true, convexity = 10, twist = -57.5288, slices = 4, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { import(file = "example009.dxf", layer = "fan_top", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); } rotate_extrude(file = "example009.dxf", layer = "fan_side", origin = [0, -40], scale = 1, convexity = 10, $fn = 0, $fa = 12, $fs = 2); diff --git a/tests/regression/dumptest/include-tests-expected.txt b/tests/regression/dumptest/include-tests-expected.txt index 47f731e..3f3ecd9 100644 --- a/tests/regression/dumptest/include-tests-expected.txt +++ b/tests/regression/dumptest/include-tests-expected.txt @@ -62,7 +62,7 @@ multmatrix([[1, 0, 0, -6], [0, 1, 0, 0], [0, 0, 1, 19], [0, 0, 0, 1]]) { multmatrix([[0, 0, 1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]]) { group() { - linear_extrude(height = 12, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 12, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { polygon(points = [[0, 0], [18, 0], [0, 4]], paths = [[0, 1, 2]], convexity = 1); } } diff --git a/tests/regression/dumptest/linear_extrude-expected.txt b/tests/regression/dumptest/linear_extrude-expected.txt index ec46e66..9ad9e00 100644 --- a/tests/regression/dumptest/linear_extrude-expected.txt +++ b/tests/regression/dumptest/linear_extrude-expected.txt @@ -1,2 +1,2 @@ - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2); + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2); diff --git a/tests/regression/dumptest/linear_extrude-tests-expected.txt b/tests/regression/dumptest/linear_extrude-tests-expected.txt index 298b7e7..c031ed8 100644 --- a/tests/regression/dumptest/linear_extrude-tests-expected.txt +++ b/tests/regression/dumptest/linear_extrude-tests-expected.txt @@ -3,11 +3,11 @@ rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 2) { cube(size = [1, 1, 1], center = false); } - linear_extrude(height = 10, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 10, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { square(size = [10, 10], center = false); } multmatrix([[1, 0, 0, 19], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 10, center = true, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 10, center = true, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { difference() { circle($fn = 0, $fa = 12, $fs = 2, r = 5); circle($fn = 0, $fa = 12, $fs = 2, r = 3); @@ -15,22 +15,22 @@ } } multmatrix([[1, 0, 0, 31.5], [0, 1, 0, 2.5], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 10, center = false, convexity = 1, twist = -45, slices = 3, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 10, center = false, convexity = 1, twist = -45, slices = 3, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { polygon(points = [[-5, -2.5], [5, -2.5], [0, 2.5]], paths = undef, convexity = 1); } } multmatrix([[1, 0, 0, 0], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 20, center = false, convexity = 1, twist = 45, slices = 2, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 20, center = false, convexity = 1, twist = 45, slices = 2, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { square(size = [10, 10], center = false); } } multmatrix([[1, 0, 0, 19], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 20, center = false, convexity = 1, twist = 45, slices = 10, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 20, center = false, convexity = 1, twist = 45, slices = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { square(size = [10, 10], center = false); } } multmatrix([[1, 0, 0, -15], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 5, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 5, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { square(size = [10, 10], center = false); } } diff --git a/tests/regression/dumptest/localfiles-compatibility-test-expected.txt b/tests/regression/dumptest/localfiles-compatibility-test-expected.txt index 8725061..95ba49b 100644 --- a/tests/regression/dumptest/localfiles-compatibility-test-expected.txt +++ b/tests/regression/dumptest/localfiles-compatibility-test-expected.txt @@ -1,9 +1,9 @@ group() { - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { import(file = "localfile.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); } multmatrix([[1, 0, 0, -250], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(file = "localfile.dxf", layer = "", origin = [0, 0], scale = 1, height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2); + linear_extrude(file = "localfile.dxf", layer = "", origin = [0, 0], height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2); } multmatrix([[1, 0, 0, 0], [0, 1, 0, 350], [0, 0, 1, 0], [0, 0, 0, 1]]) { rotate_extrude(file = "localfile.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); diff --git a/tests/regression/dumptest/localfiles-test-expected.txt b/tests/regression/dumptest/localfiles-test-expected.txt index 7a84e88..a7e81e5 100644 --- a/tests/regression/dumptest/localfiles-test-expected.txt +++ b/tests/regression/dumptest/localfiles-test-expected.txt @@ -1,9 +1,9 @@ group() { - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { import(file = "localfiles_dir/localfile.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); } multmatrix([[1, 0, 0, -250], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(file = "localfiles_dir/localfile.dxf", layer = "", origin = [0, 0], scale = 1, height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2); + linear_extrude(file = "localfiles_dir/localfile.dxf", layer = "", origin = [0, 0], height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2); } multmatrix([[1, 0, 0, 0], [0, 1, 0, 350], [0, 0, 1, 0], [0, 0, 0, 1]]) { rotate_extrude(file = "localfiles_dir/localfile.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); diff --git a/tests/regression/dumptest/projection-tests-expected.txt b/tests/regression/dumptest/projection-tests-expected.txt index 69cb49c..92e6870 100644 --- a/tests/regression/dumptest/projection-tests-expected.txt +++ b/tests/regression/dumptest/projection-tests-expected.txt @@ -3,13 +3,13 @@ projection(cut = true, convexity = 0) { square(size = [1, 1], center = false); } - linear_extrude(height = 20, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 20, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { projection(cut = false, convexity = 0) { sphere($fn = 0, $fa = 12, $fs = 2, r = 10); } } multmatrix([[1, 0, 0, 22], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 20, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 20, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { projection(cut = true, convexity = 0) { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 9], [0, 0, 0, 1]]) { sphere($fn = 0, $fa = 12, $fs = 2, r = 10); @@ -18,7 +18,7 @@ } } multmatrix([[1, 0, 0, 44], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 20, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 20, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { projection(cut = true, convexity = 0) { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 7], [0, 0, 0, 1]]) { sphere($fn = 0, $fa = 12, $fs = 2, r = 10); @@ -27,7 +27,7 @@ } } multmatrix([[1, 0, 0, 0], [0, 1, 0, -22], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 5, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 5, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { projection(cut = true, convexity = 0) { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -4.999999], [0, 0, 0, 1]]) { cube(size = [10, 10, 10], center = true); @@ -36,7 +36,7 @@ } } multmatrix([[1, 0, 0, 0], [0, 1, 0, -44], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(height = 5, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 5, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { projection(cut = true, convexity = 0) { union() { difference() { diff --git a/tests/regression/dumptest/scale2D-tests-expected.txt b/tests/regression/dumptest/scale2D-tests-expected.txt index 6d4c096..9465b8c 100644 --- a/tests/regression/dumptest/scale2D-tests-expected.txt +++ b/tests/regression/dumptest/scale2D-tests-expected.txt @@ -17,14 +17,14 @@ } } } - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { multmatrix([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { group() { square(size = [2, 3], center = true); } } } - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { multmatrix([[0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { group() { square(size = [2, 3], center = true); diff --git a/tests/regression/dumptest/scale3D-tests-expected.txt b/tests/regression/dumptest/scale3D-tests-expected.txt index c06b2fe..e802117 100644 --- a/tests/regression/dumptest/scale3D-tests-expected.txt +++ b/tests/regression/dumptest/scale3D-tests-expected.txt @@ -19,21 +19,21 @@ } } } - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { multmatrix([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) { group() { cylinder($fn = 8, $fa = 12, $fs = 2, h = 1, r1 = 1, r2 = 1, center = true); } } } - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { multmatrix([[0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) { group() { cylinder($fn = 8, $fa = 12, $fs = 2, h = 1, r1 = 1, r2 = 1, center = true); } } } - linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) { group() { cylinder($fn = 8, $fa = 12, $fs = 2, h = 1, r1 = 1, r2 = 1, center = true); diff --git a/tests/regression/dumptest/use-tests-expected.txt b/tests/regression/dumptest/use-tests-expected.txt index dce0b7d..1095708 100644 --- a/tests/regression/dumptest/use-tests-expected.txt +++ b/tests/regression/dumptest/use-tests-expected.txt @@ -39,10 +39,10 @@ group() { multmatrix([[0, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 0, 0], [0, 0, 0, 1]]) { union() { - linear_extrude(height = 1.5, center = true, convexity = 1, twist = 0, slices = 2, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 1.5, center = true, convexity = 1, twist = 0, slices = 2, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { circle($fn = 30, $fa = 12, $fs = 2, r = 0.3); } - linear_extrude(height = 1.5, center = true, convexity = 1, twist = 0, slices = 2, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 1.5, center = true, convexity = 1, twist = 0, slices = 2, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { projection(cut = false, convexity = 0) { multmatrix([[0, 0, -1, 0], [0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1]]) { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.31819805153], [0, 0, 0, 1]]) { @@ -81,7 +81,7 @@ multmatrix([[1, 0, 0, -6], [0, 1, 0, 0], [0, 0, 1, 19], [0, 0, 0, 1]]) { multmatrix([[0, 0, 1, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]]) { group() { - linear_extrude(height = 12, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + linear_extrude(height = 12, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { polygon(points = [[0, 0], [18, 0], [0, 4]], paths = [[0, 1, 2]], convexity = 1); } } -- cgit v0.10.1 From 84eaad145709f4b2e1e5cf7dcdebf3cd32722301 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Sun, 12 May 2013 12:19:04 -0500 Subject: update to match new mxe. add 'builder' script to automate some stuff diff --git a/README.md b/README.md index 0f4d8d7..5bbe8b6 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,7 @@ complete, build OpenSCAD and package it to an installer: If you wish you can only build the openscad.exe binary: cd mingw32 - i686-pc-mingw32-qmake .. CONFIG+=mingw-cross-env + qmake .. CONFIG+=mingw-cross-env make ### Compilation diff --git a/scripts/builder.sh b/scripts/builder.sh new file mode 100755 index 0000000..e244cf5 --- /dev/null +++ b/scripts/builder.sh @@ -0,0 +1,103 @@ +#!/usr/bin/env bash + +# build&upload script for linux & windows binaries +# tested under linux + +# requirements - +# see http://mxe.cc for required tools (scons, perl, yasm, etc etc etc) + +# todo - 64 bit windows (needs mxe 64 bit stable) +# +# todo - can we build 32 bit linux from within 64 bit linux? +# +# todo - make linux work + +check_starting_path() +{ + if [ -e openscad.pro ]; then + echo 'please start from a clean directory outside of openscad' + exit + fi +} + +get_source_code() +{ + git clone http://github.com/openscad/openscad.git + cd openscad + git submodule update --init # MCAD +} + +build_win32() +{ + . ./scripts/setenv-mingw-xbuild.sh + ./scripts/mingw-x-build-dependencies.sh + ./scripts/release-common.sh mingw32 +} + +build_lin32() +{ + . ./scripts/setenv-unibuild.sh clang + ./scripts/uni-build-dependencies.sh + ./scripts/release-common.sh +} + +upload_win_generic() +{ + if [ -e $3 ]; then + echo $3 found + else + echo $3 not found + fi + opts= + opts="$opts -p openscad" + opts="$opts -u $2" + opts="$opts $3" + echo python ./scripts/googlecode_upload.py -s "$1" $opts + python ./scripts/googlecode_upload.py -s "$1" $opts +} + +upload_win32() +{ + SUMMARY1="Windows x86-32 Snapshot Zipfile" + SUMMARY2="Windows x86-32 Snapshot Installer" + DATECODE=`date +"%Y.%m.%d"` + PACKAGEFILE1=./mingw32/OpenSCAD-$DATECODE-x86-32.zip + PACKAGEFILE2=./mingw32/OpenSCAD-$DATECODE-x86-32-Installer.exe + upload_win_generic "$SUMMARY1" $USERNAME $PACKAGEFILE1 + upload_win_generic "$SUMMARY2" $USERNAME $PACKAGEFILE2 +} + +read_username_from_user() +{ + echo 'Please enter your username for https://code.google.com/hosting/settings' + echo -n 'Username:' + read -s USERNAME + echo 'username is ' $USERNAME +} + +read_password_from_user() +{ + echo 'Please enter your password for https://code.google.com/hosting/settings' + echo -n 'Password:' + read -s PASSWORD1 + echo + echo -n 'Verify :' + read -s PASSWORD2 + echo + if [ ! $PASSWORD1 = $PASSWORD2 ]; then + echo 'error - passwords dont match' + exit + fi + OSUPL_PASSWORD=$PASSWORD1 + export OSUPL_PASSWORD +} + +check_starting_path +read_username_from_user +read_password_from_user +get_source_code +build_win32 +upload_win32 + + + diff --git a/scripts/googlecode_upload.py b/scripts/googlecode_upload.py index 188dd6c..c0fe4c9 100755 --- a/scripts/googlecode_upload.py +++ b/scripts/googlecode_upload.py @@ -189,7 +189,7 @@ def encode_upload_request(fields, file_path): def upload_find_auth(file_path, project_name, summary, labels=None, - user_name=None, password=None, tries=3): + user_name=None, password=None, tries=1): """Find credentials and upload a file to a Google Code project's file server. file_path, project_name, summary, and labels are passed as-is to upload. @@ -203,6 +203,8 @@ def upload_find_auth(file_path, project_name, summary, labels=None, user_name: Your Google account name. tries: How many attempts to make. """ + print 'uploading. username: ', user_name + print 'password detected:', password!=None if user_name is None or password is None: from netrc import netrc authenticators = None @@ -255,14 +257,20 @@ def main(): help='Google Code project name') parser.add_option('-u', '--user', dest='user', help='Your Google Code username') - parser.add_option('-w', '--password', dest='password', - help='Your Google Code password') + #this is a massive security hole. anyone using 'ps' could steal p/w + #parser.add_option('-w', '--password', dest='password', + # help='Your Google Code password') parser.add_option('-l', '--labels', dest='labels', help='An optional list of comma-separated labels to attach ' 'to the file') options, args = parser.parse_args() + if os.environ.has_key('OSUPL_PASSWORD'): + options.password=os.environ['OSUPL_PASSWORD'] + else: + options.password=None + if not options.summary: parser.error('File summary is missing.') elif not options.project: @@ -279,6 +287,7 @@ def main(): else: labels = None + print 'read arguments' status, reason, url = upload_find_auth(file_path, options.project, options.summary, labels, options.user, options.password) @@ -293,4 +302,5 @@ def main(): if __name__ == '__main__': + print sys.argv sys.exit(main()) diff --git a/scripts/mingw-x-build-dependencies.sh b/scripts/mingw-x-build-dependencies.sh index ee51848..7a16530 100755 --- a/scripts/mingw-x-build-dependencies.sh +++ b/scripts/mingw-x-build-dependencies.sh @@ -49,7 +49,7 @@ fi echo "entering" $MXEDIR cd $MXEDIR -echo "make mpfr eigen opencsg cgal qt -j $NUMCPU JOBS=$NUMJOBS" +echo "make mpfr eigen opencsg cgal qt nsis -j $NUMCPU JOBS=$NUMJOBS" make mpfr eigen opencsg cgal qt nsis -j $NUMCPU JOBS=$NUMJOBS #make mpfr -j $NUMCPU JOBS=$NUMJOBS # for testing diff --git a/scripts/release-common.sh b/scripts/release-common.sh index 10a1c18..85f0e71 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -134,7 +134,7 @@ esac case $OS in LINXWIN) - cd $DEPLOYDIR && i686-pc-mingw32-qmake VERSION=$VERSION OPENSCAD_COMMIT=$OPENSCAD_COMMIT CONFIG+=$CONFIG CONFIG+=mingw-cross-env CONFIG-=debug ../openscad.pro + cd $DEPLOYDIR && qmake VERSION=$VERSION OPENSCAD_COMMIT=$OPENSCAD_COMMIT CONFIG+=$CONFIG CONFIG+=mingw-cross-env CONFIG-=debug ../openscad.pro cd $OPENSCADDIR ;; *) @@ -144,7 +144,8 @@ esac case $OS in LINXWIN) - cd $DEPLOYDIR && make -s clean + #cd $DEPLOYDIR + make -s clean ## comment out for test-run cd $OPENSCADDIR ;; *) @@ -172,10 +173,14 @@ case $OS in # dont use paralell builds, it can error-out on parser_yacc. # make main openscad.exe - cd $DEPLOYDIR && make $TARGET - + cd $DEPLOYDIR + make $TARGET ## comment out for test-run + if [ ! -e $TARGET/openscad.exe ]; then + echo 'build failed. stopping.' + exit + fi # make console pipe-able openscad.com - see winconsole.pri for info - i686-pc-mingw32-qmake CONFIG+=winconsole ../openscad.pro + qmake CONFIG+=winconsole ../openscad.pro make cd $OPENSCADDIR @@ -245,21 +250,24 @@ case $OS in cp win32deps/* openscad-$VERSION cp $TARGET/openscad.exe openscad-$VERSION cp $TARGET/openscad.com openscad-$VERSION - rm -f openscad-$VERSION.zip - "$ZIP" $ZIPARGS openscad-$VERSION.zip openscad-$VERSION + rm -f openscad-$VERSION.x86-$ARCH.zip + "$ZIP" $ZIPARGS openscad-$VERSION.x86-$ARCH.zip openscad-$VERSION rm -rf openscad-$VERSION echo "Binary created: openscad-$VERSION.zip" ;; LINXWIN) + BINFILE=$DEPLOYDIR/OpenSCAD-$VERSION-x86-$ARCH.zip + INSTFILE=$DEPLOYDIR/OpenSCAD-$VERSION-x86-$ARCH-Installer.exe + #package - echo "Creating binary package" + echo "Creating binary zip package" cd $DEPLOYDIR cp $TARGET/openscad.exe openscad-$VERSION cp $TARGET/openscad.com openscad-$VERSION - rm -f OpenSCAD-$VERSION.zip - "$ZIP" $ZIPARGS OpenSCAD-$VERSION.zip openscad-$VERSION + rm -f OpenSCAD-$VERSION.x86-$ARCH.zip + "$ZIP" $ZIPARGS $BINFILE openscad-$VERSION cd $OPENSCADDIR - echo "Binary package created" + echo "Binary zip package created" echo "Creating installer" echo "Copying NSIS files to $DEPLOYDIR/openscad-$VERSION" @@ -270,11 +278,9 @@ case $OS in # NSISDEBUG= # leave blank for full log echo $MAKENSIS $NSISDEBUG installer.nsi $MAKENSIS $NSISDEBUG installer.nsi - cp $DEPLOYDIR/openscad-$VERSION/openscad_setup.exe $DEPLOYDIR/OpenSCAD-$VERSION-Installer.exe + cp $DEPLOYDIR/openscad-$VERSION/openscad_setup.exe $INSTFILE cd $OPENSCADDIR - BINFILE=$DEPLOYDIR/OpenSCAD-$VERSION.zip - INSTFILE=$DEPLOYDIR/OpenSCAD-$VERSION-Installer.exe if [ -e $BINFILE ]; then if [ -e $INSTFILE ]; then echo diff --git a/scripts/setenv-mingw-xbuild.sh b/scripts/setenv-mingw-xbuild.sh index e8976b7..e31534e 100644 --- a/scripts/setenv-mingw-xbuild.sh +++ b/scripts/setenv-mingw-xbuild.sh @@ -27,11 +27,6 @@ fi export PATH=$MXEDIR/usr/bin:$PATH -echo BASEDIR: $BASEDIR -echo MXEDIR: $MXEDIR -echo DEPLOYDIR: $DEPLOYDIR -echo PATH modified with $MXEDIR/usr/bin - if [ ! -e $DEPLOYDIR ]; then mkdir -p $DEPLOYDIR fi @@ -39,5 +34,13 @@ fi echo linking $MXEDIR/usr/i686-pc-mingw32/ to $DEPLOYDIR/mingw-cross-env rm -f $DEPLOYDIR/mingw-cross-env ln -s $MXEDIR/usr/i686-pc-mingw32/ $DEPLOYDIR/mingw-cross-env +export PATH=$MXEDIR/usr/i686-pc-mingw32/qt/bin:$PATH + +echo BASEDIR: $BASEDIR +echo MXEDIR: $MXEDIR +echo DEPLOYDIR: $DEPLOYDIR +echo PATH modified: $MXEDIR/usr/bin +echo PATH modified: $MXEDIR/usr/i686-pc-mingw32/qt/bin + -- cgit v0.10.1 From 348d13cf3bafc0369691b0fc351a75401ee79ccf Mon Sep 17 00:00:00 2001 From: Don Bright Date: Sun, 12 May 2013 12:22:11 -0500 Subject: add notes diff --git a/scripts/builder.sh b/scripts/builder.sh index e244cf5..4bece8a 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -1,11 +1,13 @@ #!/usr/bin/env bash -# build&upload script for linux & windows binaries +# build&upload script for linux & windows snapshot binaries # tested under linux # requirements - # see http://mxe.cc for required tools (scons, perl, yasm, etc etc etc) +# todo - auto update webpage to link to proper snapshot +# # todo - 64 bit windows (needs mxe 64 bit stable) # # todo - can we build 32 bit linux from within 64 bit linux? -- cgit v0.10.1 From 0cc3bb3890fc144143bd3c11d605ca64f3c29266 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Mon, 13 May 2013 06:57:19 -0500 Subject: fix indentation, uncomment cd command, fix reading of username diff --git a/scripts/builder.sh b/scripts/builder.sh index 4bece8a..c2f81e8 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -73,7 +73,7 @@ read_username_from_user() { echo 'Please enter your username for https://code.google.com/hosting/settings' echo -n 'Username:' - read -s USERNAME + read USERNAME echo 'username is ' $USERNAME } diff --git a/scripts/release-common.sh b/scripts/release-common.sh index 85f0e71..02b276b 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -144,7 +144,7 @@ esac case $OS in LINXWIN) - #cd $DEPLOYDIR + cd $DEPLOYDIR make -s clean ## comment out for test-run cd $OPENSCADDIR ;; @@ -174,8 +174,8 @@ case $OS in # make main openscad.exe cd $DEPLOYDIR - make $TARGET ## comment out for test-run - if [ ! -e $TARGET/openscad.exe ]; then + make $TARGET ## comment out for test-run + if [ ! -e $TARGET/openscad.exe ]; then echo 'build failed. stopping.' exit fi -- cgit v0.10.1 From ee6f149dd0d9bcef0cb94cef154ed32f308c23e1 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Mon, 13 May 2013 16:27:17 -0400 Subject: bugfix: Fixed recursion crash (#346) diff --git a/src/expr.cc b/src/expr.cc index 746c0e3..9eaeeef 100644 --- a/src/expr.cc +++ b/src/expr.cc @@ -31,6 +31,7 @@ #include #include #include "stl-utils.h" +#include "printutils.h" #include #include @@ -40,7 +41,7 @@ Expression::Expression() Expression::Expression(const std::string &type, Expression *left, Expression *right) - : type(type) + : type(type), recursioncount(0) { this->children.push_back(left); this->children.push_back(right); @@ -61,6 +62,18 @@ Expression::~Expression() std::for_each(this->children.begin(), this->children.end(), del_fun()); } +class FuncRecursionGuard +{ +public: + FuncRecursionGuard(const Expression &e) : expr(e) { + expr.recursioncount++; + } + ~FuncRecursionGuard() { expr.recursioncount--; } + bool recursion_detected() const { return (expr.recursioncount > 100); } +private: + const Expression &expr; +}; + Value Expression::evaluate(const Context *context) const { if (this->type == "!") @@ -141,6 +154,12 @@ Value Expression::evaluate(const Context *context) const return Value(); } if (this->type == "F") { + FuncRecursionGuard g(*this); + if (g.recursion_detected()) { + PRINTB("ERROR: Recursion detected calling function '%s'", this->call_funcname); + return Value(); + } + EvalContext c(context, this->call_arguments); return context->evaluate_function(this->call_funcname, &c); } diff --git a/src/expression.h b/src/expression.h index 6c03f52..3629704 100644 --- a/src/expression.h +++ b/src/expression.h @@ -40,6 +40,8 @@ public: Value evaluate(const class Context *context) const; std::string toString() const; + + mutable int recursioncount; }; std::ostream &operator<<(std::ostream &stream, const Expression &expr); diff --git a/src/modcontext.cc b/src/modcontext.cc index 44c2002..3879811 100644 --- a/src/modcontext.cc +++ b/src/modcontext.cc @@ -27,20 +27,6 @@ void ModuleContext::initializeModule(const class Module &module) } } -class RecursionGuard -{ -public: - RecursionGuard(const ModuleContext &c, const std::string &name) : c(c), name(name) { - c.recursioncount[name]++; - } - ~RecursionGuard() { if (--c.recursioncount[name] == 0) c.recursioncount.erase(name); } - bool recursion_detected() const { return (c.recursioncount[name] > 100); } -private: - const ModuleContext &c; - const std::string &name; -}; - - /*! Only used to initialize builtins for the top-level root context */ @@ -81,12 +67,6 @@ const AbstractModule *ModuleContext::findLocalModule(const std::string &name) co Value ModuleContext::evaluate_function(const std::string &name, const EvalContext *evalctx) const { - RecursionGuard g(*this, name); - if (g.recursion_detected()) { - PRINTB("Recursion detected calling function '%s'", name); - return Value(); - } - const AbstractFunction *foundf = findLocalFunction(name); if (foundf) return foundf->evaluate(this, evalctx); @@ -141,12 +121,6 @@ FileContext::FileContext(const class FileModule &module, const Context *parent) Value FileContext::evaluate_function(const std::string &name, const EvalContext *evalctx) const { - RecursionGuard g(*this, name); - if (g.recursion_detected()) { - PRINTB("Recursion detected calling function '%s'", name); - return Value(); - } - const AbstractFunction *foundf = findLocalFunction(name); if (foundf) return foundf->evaluate(this, evalctx); diff --git a/src/modcontext.h b/src/modcontext.h index 4479051..0b3e48c 100644 --- a/src/modcontext.h +++ b/src/modcontext.h @@ -36,8 +36,6 @@ public: #ifdef DEBUG virtual void dump(const class AbstractModule *mod, const ModuleInstantiation *inst); #endif - - mutable boost::unordered_map recursioncount; }; class FileContext : public ModuleContext diff --git a/src/module.cc b/src/module.cc index 8b84c07..e853457 100644 --- a/src/module.cc +++ b/src/module.cc @@ -135,8 +135,28 @@ Module::~Module() { } +class ModRecursionGuard +{ +public: + ModRecursionGuard(const ModuleInstantiation &inst) : inst(inst) { + inst.recursioncount++; + } + ~ModRecursionGuard() { + inst.recursioncount--; + } + bool recursion_detected() const { return (inst.recursioncount > 100); } +private: + const ModuleInstantiation &inst; +}; + AbstractNode *Module::instantiate(const Context *ctx, const ModuleInstantiation *inst, const EvalContext *evalctx) const { + ModRecursionGuard g(*inst); + if (g.recursion_detected()) { + PRINTB("ERROR: Recursion detected calling module '%s'", inst->name()); + return NULL; + } + ModuleContext c(ctx, evalctx); c.initializeModule(*this); c.set_variable("$children", Value(double(inst->scope.children.size()))); diff --git a/src/module.h b/src/module.h index 8f1ccb7..9f46d37 100644 --- a/src/module.h +++ b/src/module.h @@ -13,7 +13,7 @@ class ModuleInstantiation { public: ModuleInstantiation(const std::string &name = "") - : tag_root(false), tag_highlight(false), tag_background(false), modname(name) { } + : tag_root(false), tag_highlight(false), tag_background(false), recursioncount(0), modname(name) { } virtual ~ModuleInstantiation(); std::string dump(const std::string &indent) const; @@ -35,6 +35,7 @@ public: bool tag_root; bool tag_highlight; bool tag_background; + mutable int recursioncount; protected: std::string modname; std::string modpath; -- cgit v0.10.1 From a1ade23e98307562f25a4496100c18af800e088f Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 14 May 2013 01:31:44 +0200 Subject: bugfix: messed up parser filenames diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 38b2758..9821d70 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -329,8 +329,9 @@ if (WIN32) set(FLEX_UNISTD_FLAG "-DYY_NO_UNISTD_H") endif() FLEX_TARGET(OpenSCADlexer ../src/lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp COMPILE_FLAGS "-Plexer ${FLEX_UNISTD_FLAG}") -BISON_TARGET(OpenSCADparser ../src/parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp COMPILE_FLAGS "-p parser") +BISON_TARGET(OpenSCADparser ../src/parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser_yacc.c COMPILE_FLAGS "-p parser") ADD_FLEX_BISON_DEPENDENCY(OpenSCADlexer OpenSCADparser) +set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/parser_yacc.c PROPERTIES LANGUAGE "CXX") # CGAL -- cgit v0.10.1 From f179e0b5670631fe6ade5d1cc531529f4fcdfc87 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Mon, 13 May 2013 20:40:32 -0400 Subject: Forgot to initialize recursioncount in all constructors diff --git a/src/expr.cc b/src/expr.cc index 9eaeeef..4355400 100644 --- a/src/expr.cc +++ b/src/expr.cc @@ -35,7 +35,7 @@ #include #include -Expression::Expression() +Expression::Expression() : recursioncount(0) { } @@ -48,12 +48,12 @@ Expression::Expression(const std::string &type, } Expression::Expression(const std::string &type, Expression *expr) - : type(type) + : type(type), recursioncount(0) { this->children.push_back(expr); } -Expression::Expression(const Value &val) : const_value(val), type("C") +Expression::Expression(const Value &val) : const_value(val), type("C"), recursioncount(0) { } -- cgit v0.10.1 From beda4a79524e5dcc667455938a3405a9e9b3f735 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 14 May 2013 02:55:53 +0200 Subject: Updated expected test: ERROR label diff --git a/tests/regression/echotest/recursion-tests-expected.txt b/tests/regression/echotest/recursion-tests-expected.txt index f4897ee..e5c99b1 100644 --- a/tests/regression/echotest/recursion-tests-expected.txt +++ b/tests/regression/echotest/recursion-tests-expected.txt @@ -1,2 +1,2 @@ -Recursion detected calling function 'crash' +ERROR: Recursion detected calling function 'crash' ECHO: undef -- cgit v0.10.1 From 6161214083ba6fc3c6cadbc98e04ad5e826cf984 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Tue, 14 May 2013 23:45:40 -0500 Subject: enable auto updateing of website thru openscad.github.com diff --git a/scripts/builder.sh b/scripts/builder.sh index c2f81e8..9dcc3a6 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -13,9 +13,12 @@ # todo - can we build 32 bit linux from within 64 bit linux? # # todo - make linux work +# +# todo - detect failure and stop check_starting_path() { + STARTPATH=$PWD if [ -e openscad.pro ]; then echo 'please start from a clean directory outside of openscad' exit @@ -45,6 +48,7 @@ build_lin32() upload_win_generic() { + # 1=file summary, 2 = username, 3 = filename if [ -e $3 ]; then echo $3 found else @@ -54,7 +58,6 @@ upload_win_generic() opts="$opts -p openscad" opts="$opts -u $2" opts="$opts $3" - echo python ./scripts/googlecode_upload.py -s "$1" $opts python ./scripts/googlecode_upload.py -s "$1" $opts } @@ -63,10 +66,17 @@ upload_win32() SUMMARY1="Windows x86-32 Snapshot Zipfile" SUMMARY2="Windows x86-32 Snapshot Installer" DATECODE=`date +"%Y.%m.%d"` - PACKAGEFILE1=./mingw32/OpenSCAD-$DATECODE-x86-32.zip - PACKAGEFILE2=./mingw32/OpenSCAD-$DATECODE-x86-32-Installer.exe - upload_win_generic "$SUMMARY1" $USERNAME $PACKAGEFILE1 - upload_win_generic "$SUMMARY2" $USERNAME $PACKAGEFILE2 + BASEDIR=./mingw32/ + WIN32_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-32.zip + WIN32_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-32-Installer.exe + upload_win_generic "$SUMMARY1" $USERNAME $BASEDIR/$WIN32_PACKAGEFILE1 + upload_win_generic "$SUMMARY2" $USERNAME $BASEDIR/$WIN32_PACKAGEFILE2 + export WIN32_PACKAGEFILE1 + export WIN32_PACKAGEFILE2 + WIN32_PACKAGEFILE1_SIZE=`ls -sh $BASEDIR/$WIN32_PACKAGEFILE1 | awk ' {print $1} ';` + WIN32_PACKAGEFILE2_SIZE=`ls -sh $BASEDIR/$WIN32_PACKAGEFILE2 | awk ' {print $1} ';` + export WIN32_PACKAGEFILE1_SIZE + export WIN32_PACKAGEFILE2_SIZE } read_username_from_user() @@ -94,12 +104,49 @@ read_password_from_user() export OSUPL_PASSWORD } +update_www_download_links() +{ + cd $STARTPATH + git clone http://github.com/openscad/openscad.github.com.git + cd openscad.github.com + cd inc + echo `pwd` + BASEURL='https://openscad.google.com/files/' + DATECODE=`date +"%Y.%m.%d"` + + rm win_snapshot_links.js + echo "snapinfo['WIN32_SNAPSHOT1_URL'] = '$BASEURL$WIN32_PACKAGEFILE1'" >> win_snapshot_links.js + echo "snapinfo['WIN32_SNAPSHOT2_URL'] = '$BASEURL$WIN32_PACKAGEFILE2'" >> win_snapshot_links.js + echo "snapinfo['WIN32_SNAPSHOT1_NAME'] = 'OpenSCAD $DATECODE'" >> win_snapshot_links.js + echo "snapinfo['WIN32_SNAPSHOT2_NAME'] = 'OpenSCAD $DATECODE'" >> win_snapshot_links.js + echo "snapinfo['WIN32_SNAPSHOT1_SIZE'] = '$WIN32_PACKAGEFILE1_SIZE'" >> win_snapshot_links.js + echo "snapinfo['WIN32_SNAPSHOT2_SIZE'] = '$WIN32_PACKAGEFILE2_SIZE'" >> win_snapshot_links.js + echo 'modified win_snapshot_links.js' + cat win_snapshot_links.js + + git diff + echo git commit -a -m 'updated snapshot links' + echo git push origin +} + +check_ssh_agent() +{ + if [ ! $SSH_AUTH_SOCK ]; then + echo 'please start an ssh-agent for github.com/openscad/openscad.github.com uploads' + echo + echo ' ssh-agent > .tmp && source .tmp && ssh-add' + echo + fi +} + +check_ssh_agent check_starting_path read_username_from_user read_password_from_user get_source_code build_win32 upload_win32 +update_www_download_links -- cgit v0.10.1 From 8cdadca9208a83d60ccb8201d439fb3dd67ec019 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Wed, 15 May 2013 17:00:40 -0500 Subject: clarify comments diff --git a/scripts/builder.sh b/scripts/builder.sh index 9dcc3a6..9449a9c 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -125,7 +125,7 @@ update_www_download_links() cat win_snapshot_links.js git diff - echo git commit -a -m 'updated snapshot links' + echo git commit -a -m 'builder.sh - updated snapshot links' echo git push origin } @@ -133,6 +133,7 @@ check_ssh_agent() { if [ ! $SSH_AUTH_SOCK ]; then echo 'please start an ssh-agent for github.com/openscad/openscad.github.com uploads' + echo 'for example:' echo echo ' ssh-agent > .tmp && source .tmp && ssh-add' echo -- cgit v0.10.1 From 2e758fcc82a8a06152f5e89ec9295783b3e889fe Mon Sep 17 00:00:00 2001 From: Don Bright Date: Wed, 15 May 2013 17:04:46 -0500 Subject: enable 'dry run' in builder script diff --git a/scripts/builder.sh b/scripts/builder.sh index 9449a9c..e0bb608 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -16,6 +16,8 @@ # # todo - detect failure and stop +dryrun= + check_starting_path() { STARTPATH=$PWD @@ -58,7 +60,11 @@ upload_win_generic() opts="$opts -p openscad" opts="$opts -u $2" opts="$opts $3" - python ./scripts/googlecode_upload.py -s "$1" $opts + if [ ! dryrun ]; then + python ./scripts/googlecode_upload.py -s "$1" $opts + else + echo dry run, not uploading to googlecode + fi } upload_win32() @@ -125,8 +131,12 @@ update_www_download_links() cat win_snapshot_links.js git diff - echo git commit -a -m 'builder.sh - updated snapshot links' - echo git push origin + if [ ! dryrun ]; then + git commit -a -m 'builder.sh - updated snapshot links' + git push origin + else + echo dry run, not updating www links + fi } check_ssh_agent() -- cgit v0.10.1 From 5f6afe8cbbdd16538b662a0880f7961a9a3aade5 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 15 May 2013 20:33:24 -0400 Subject: Update the new javascript with download info diff --git a/scripts/publish-macosx.sh b/scripts/publish-macosx.sh index 3aeeaf9..9d0423d 100755 --- a/scripts/publish-macosx.sh +++ b/scripts/publish-macosx.sh @@ -3,6 +3,41 @@ # NB! To build a release build, the VERSION and VERSIONDATE environment variables needs to be set. # See doc/release-checklist.txt +human_filesize() +{ + awk -v sum=$1 'BEGIN { + hum[1024**3]="GB"; hum[1024**2]="MB"; hum[1024]="KB"; + for (x=1024**3; x>=1024; x/=1024) { + if (sum>=x) { printf "%.1f %s\n",sum/x,hum[x]; break } + } + }' +} + +# Pass version= packagefile= filesize= +update_www_download_links() +{ + # Make the passed variables available + local $* + filesize=$(human_filesize $filesize) + webdir=../openscad.github.com + incfile=inc/mac_snapshot_links.js + BASEURL='https://openscad.google.com/files/' + DATECODE=`date +"%Y.%m.%d"` + + if [ -f $webdir/$incfile ]; then + cd $webdir + echo "snapinfo['MAC_SNAPSHOT_URL'] = '$BASEURL$packagefile'" > $incfile + echo "snapinfo['MAC_SNAPSHOT_NAME'] = 'OpenSCAD $version'" >> $incfile + echo "snapinfo['MAC_SNAPSHOT_SIZE'] = '$filesize'" >> $incfile + echo 'modified mac_snapshot_links.js' + + git --no-pager diff + echo "Web page updated. Remember to commit and push openscad.github.com" + else + echo "Web page not found at $incfile" + fi +} + if test -z "$VERSIONDATE"; then VERSIONDATE=`date "+%Y.%m.%d"` fi @@ -40,7 +75,8 @@ else APPCASTFILE=appcast.xml fi echo "Creating appcast $APPCASTFILE..." -sed -e "s,@VERSION@,$VERSION,g" -e "s,@VERSIONDATE@,$VERSIONDATE,g" -e "s,@DSASIGNATURE@,$SIGNATURE,g" -e "s,@FILESIZE@,$(stat -f "%z" OpenSCAD-$VERSION.dmg),g" $APPCASTFILE.in > $APPCASTFILE +FILESIZE=$(stat -f "%z" OpenSCAD-$VERSION.dmg) +sed -e "s,@VERSION@,$VERSION,g" -e "s,@VERSIONDATE@,$VERSIONDATE,g" -e "s,@DSASIGNATURE@,$SIGNATURE,g" -e "s,@FILESIZE@,$FILESIZE,g" $APPCASTFILE.in > $APPCASTFILE cp $APPCASTFILE ../openscad.github.com if [[ $VERSION == $VERSIONDATE ]]; then cp $APPCASTFILE ../openscad.github.com/appcast-snapshots.xml @@ -50,6 +86,9 @@ echo "Uploading..." LABELS=OpSys-OSX,Type-Executable if ! $SNAPSHOT; then LABELS=$LABELS,Featured; fi `dirname $0`/googlecode_upload.py -s 'Mac OS X Snapshot' -p openscad OpenSCAD-$VERSION.dmg -l $LABELS +if [[ $? != 0 ]]; then + exit 1 +fi # Update snapshot filename on web page -`dirname $0`/update-web.sh OpenSCAD-$VERSION.dmg +update_www_download_links version=$VERSION packagefile=OpenSCAD-$VERSION.dmg filesize=$FILESIZE -- cgit v0.10.1 From 602b529e9f737c940c7dad194d4e199f43c8bed9 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Wed, 15 May 2013 19:33:55 -0500 Subject: fix bug in dryrun settings diff --git a/scripts/builder.sh b/scripts/builder.sh index e0bb608..5b3835b 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -16,7 +16,7 @@ # # todo - detect failure and stop -dryrun= +DRYRUN= check_starting_path() { @@ -60,7 +60,7 @@ upload_win_generic() opts="$opts -p openscad" opts="$opts -u $2" opts="$opts $3" - if [ ! dryrun ]; then + if [ ! $DRYRUN ]; then python ./scripts/googlecode_upload.py -s "$1" $opts else echo dry run, not uploading to googlecode @@ -113,7 +113,7 @@ read_password_from_user() update_www_download_links() { cd $STARTPATH - git clone http://github.com/openscad/openscad.github.com.git + git clone git@github.com:openscad/openscad.github.com.git cd openscad.github.com cd inc echo `pwd` @@ -130,8 +130,8 @@ update_www_download_links() echo 'modified win_snapshot_links.js' cat win_snapshot_links.js - git diff - if [ ! dryrun ]; then + PAGER=cat git diff + if [ ! $DRYRUN ]; then git commit -a -m 'builder.sh - updated snapshot links' git push origin else -- cgit v0.10.1 From 26df5c446647aec19fa8a8615e61702950691746 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Wed, 15 May 2013 19:56:49 -0500 Subject: make size postpend 'B' for 'Bytes', for download page diff --git a/scripts/builder.sh b/scripts/builder.sh index 5b3835b..75b80f8 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -81,6 +81,8 @@ upload_win32() export WIN32_PACKAGEFILE2 WIN32_PACKAGEFILE1_SIZE=`ls -sh $BASEDIR/$WIN32_PACKAGEFILE1 | awk ' {print $1} ';` WIN32_PACKAGEFILE2_SIZE=`ls -sh $BASEDIR/$WIN32_PACKAGEFILE2 | awk ' {print $1} ';` + WIN32_PACKAGEFILE1_SIZE=`echo "$WIN32_PACKAGEFILE1_SIZE""B"` + WIN32_PACKAGEFILE2_SIZE=`echo "$WIN32_PACKAGEFILE2_SIZE""B"` export WIN32_PACKAGEFILE1_SIZE export WIN32_PACKAGEFILE2_SIZE } -- cgit v0.10.1 From 293f3cc7c9c6dfec76120714b33a458f54792545 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Thu, 16 May 2013 06:54:34 -0500 Subject: enable mingw64 cross build (alpha stage) diff --git a/eigen.pri b/eigen.pri index 5935a47..1c9a5ef 100644 --- a/eigen.pri +++ b/eigen.pri @@ -70,7 +70,12 @@ isEmpty(EIGEN_INCLUDEPATH) { } mingw-cross-env { - EIGEN_CFLAGS = $$system("i686-pc-mingw32-pkg-config --cflags eigen3") + exists(mingw-cross-env/../i686-pc-mingw32-pkg-config) { + EIGEN_CFLAGS = $$system("i686-pc-mingw32-pkg-config --cflags eigen3") + } + exists(mingw-cross-env/../x86_64-w64-mingw32-pkg-config) { + EIGEN_CFLAGS = $$system("x86_64-w64-mingw32-pkg-config --cflags eigen3") + } EIGEN_INCLUDEPATH = $$replace(EIGEN_CFLAGS,"-I","") } diff --git a/mingw-cross-env.pri b/mingw-cross-env.pri index 9b808c0..a447fd8 100644 --- a/mingw-cross-env.pri +++ b/mingw-cross-env.pri @@ -4,7 +4,9 @@ CONFIG(mingw-cross-env) { LIBS += mingw-cross-env/lib/libglut.a LIBS += mingw-cross-env/lib/libopengl32.a LIBS += mingw-cross-env/lib/libGLEW.a - LIBS += mingw-cross-env/lib/libglaux.a + exists( mingw-cross-env/lib/libglaux.a ) { + LIBS += mingw-cross-env/lib/libglaux.a + } LIBS += mingw-cross-env/lib/libglu32.a LIBS += mingw-cross-env/lib/libopencsg.a LIBS += mingw-cross-env/lib/libmpfr.a diff --git a/scripts/LogicLib.nsh b/scripts/LogicLib.nsh new file mode 100644 index 0000000..2f8968c --- /dev/null +++ b/scripts/LogicLib.nsh @@ -0,0 +1,792 @@ +; NSIS LOGIC LIBRARY - LogicLib.nsh +; Version 2.6 - 08/12/2007 +; By dselkirk@hotmail.com +; and eccles@users.sf.net +; with IfNot support added by Message +; +; Questions/Comments - +; See http://forums.winamp.com/showthread.php?s=&postid=1116241 +; +; Description: +; Provides the use of various logic statements within NSIS. +; +; Usage: +; The following "statements" are available: +; If|IfNot|Unless..{ElseIf|ElseIfNot|ElseUnless}..[Else]..EndIf|EndUnless +; - Conditionally executes a block of statements, depending on the value +; of an expression. IfNot and Unless are equivalent and +; interchangeable, as are ElseIfNot and ElseUnless. +; AndIf|AndIfNot|AndUnless|OrIf|OrIfNot|OrUnless +; - Adds any number of extra conditions to If, IfNot, Unless, ElseIf, +; ElseIfNot and ElseUnless statements. +; IfThen|IfNotThen..|..| +; - Conditionally executes an inline statement, depending on the value +; of an expression. +; IfCmd..||..| +; - Conditionally executes an inline statement, depending on a true +; value of the provided NSIS function. +; Select..{Case[2|3|4|5]}..[CaseElse|Default]..EndSelect +; - Executes one of several blocks of statements, depending on the value +; of an expression. +; Switch..{Case|CaseElse|Default}..EndSwitch +; - Jumps to one of several labels, depending on the value of an +; expression. +; Do[While|Until]..{ExitDo|Continue|Break}..Loop[While|Until] +; - Repeats a block of statements until stopped, or depending on the +; value of an expression. +; While..{ExitWhile|Continue|Break}..EndWhile +; - An alias for DoWhile..Loop (for backwards-compatibility) +; For[Each]..{ExitFor|Continue|Break}..Next +; - Repeats a block of statements varying the value of a variable. +; +; The following "expressions" are available: +; Standard (built-in) string tests (which are case-insensitive): +; a == b; a != b +; Additional case-insensitive string tests (using System.dll): +; a S< b; a S>= b; a S> b; a S<= b +; Case-sensitive string tests: +; a S== b; a S!= b +; Standard (built-in) signed integer tests: +; a = b; a <> b; a < b; a >= b; a > b; a <= b +; Standard (built-in) unsigned integer tests: +; a U< b; a U>= b; a U> b; a U<= b +; 64-bit integer tests (using System.dll): +; a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b +; Built-in NSIS flag tests: +; ${Abort}; ${Errors}; ${RebootFlag}; ${Silent} +; Built-in NSIS other tests: +; ${FileExists} a +; Any conditional NSIS instruction test: +; ${Cmd} a +; Section flag tests: +; ${SectionIsSelected} a; ${SectionIsSectionGroup} a; +; ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a; +; ${SectionIsReadOnly} a; ${SectionIsExpanded} a; +; ${SectionIsPartiallySelected} a +; +; Examples: +; See LogicLib.nsi in the Examples folder for lots of example usage. + +!verbose push +!verbose 3 +!ifndef LOGICLIB_VERBOSITY + !define LOGICLIB_VERBOSITY 3 +!endif +!define _LOGICLIB_VERBOSITY ${LOGICLIB_VERBOSITY} +!undef LOGICLIB_VERBOSITY +!verbose ${_LOGICLIB_VERBOSITY} + +!ifndef LOGICLIB + !define LOGICLIB + !define | "'" + !define || "' '" + !define LOGICLIB_COUNTER 0 + + !include Sections.nsh + + !macro _LOGICLIB_TEMP + !ifndef _LOGICLIB_TEMP + !define _LOGICLIB_TEMP + Var /GLOBAL _LOGICLIB_TEMP ; Temporary variable to aid the more elaborate logic tests + !endif + !macroend + + !macro _IncreaseCounter + !define _LOGICLIB_COUNTER ${LOGICLIB_COUNTER} + !undef LOGICLIB_COUNTER + !define /math LOGICLIB_COUNTER ${_LOGICLIB_COUNTER} + 1 + !undef _LOGICLIB_COUNTER + !macroend + + !macro _PushLogic + !insertmacro _PushScope Logic _LogicLib_Label_${LOGICLIB_COUNTER} + !insertmacro _IncreaseCounter + !macroend + + !macro _PopLogic + !insertmacro _PopScope Logic + !macroend + + !macro _PushScope Type label + !ifdef _${Type} ; If we already have a statement + !define _Cur${Type} ${_${Type}} + !undef _${Type} + !define _${Type} ${label} + !define ${_${Type}}Prev${Type} ${_Cur${Type}} ; Save the current logic + !undef _Cur${Type} + !else + !define _${Type} ${label} ; Initialise for first statement + !endif + !macroend + + !macro _PopScope Type + !ifndef _${Type} + !error "Cannot use _Pop${Type} without a preceding _Push${Type}" + !endif + !ifdef ${_${Type}}Prev${Type} ; If a previous statment was active then restore it + !define _Cur${Type} ${_${Type}} + !undef _${Type} + !define _${Type} ${${_Cur${Type}}Prev${Type}} + !undef ${_Cur${Type}}Prev${Type} + !undef _Cur${Type} + !else + !undef _${Type} + !endif + !macroend + + ; String tests + !macro _== _a _b _t _f + StrCmp `${_a}` `${_b}` `${_t}` `${_f}` + !macroend + + !macro _!= _a _b _t _f + !insertmacro _== `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + ; Case-sensitive string tests + !macro _S== _a _b _t _f + StrCmpS `${_a}` `${_b}` `${_t}` `${_f}` + !macroend + + !macro _S!= _a _b _t _f + !insertmacro _S== `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + ; Extra string tests (cannot do these case-sensitively - I tried and lstrcmp still ignored the case) + !macro _StrCmpI _a _b _e _l _m + !insertmacro _LOGICLIB_TEMP + System::Call `kernel32::lstrcmpiA(ts, ts) i.s` `${_a}` `${_b}` + Pop $_LOGICLIB_TEMP + IntCmp $_LOGICLIB_TEMP 0 `${_e}` `${_l}` `${_m}` + !macroend + + !macro _S< _a _b _t _f + !insertmacro _StrCmpI `${_a}` `${_b}` `${_f}` `${_t}` `${_f}` + !macroend + + !macro _S>= _a _b _t _f + !insertmacro _S< `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + !macro _S> _a _b _t _f + !insertmacro _StrCmpI `${_a}` `${_b}` `${_f}` `${_f}` `${_t}` + !macroend + + !macro _S<= _a _b _t _f + !insertmacro _S> `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + ; Integer tests + !macro _= _a _b _t _f + IntCmp `${_a}` `${_b}` `${_t}` `${_f}` `${_f}` + !macroend + + !macro _<> _a _b _t _f + !insertmacro _= `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + !macro _< _a _b _t _f + IntCmp `${_a}` `${_b}` `${_f}` `${_t}` `${_f}` + !macroend + + !macro _>= _a _b _t _f + !insertmacro _< `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + !macro _> _a _b _t _f + IntCmp `${_a}` `${_b}` `${_f}` `${_f}` `${_t}` + !macroend + + !macro _<= _a _b _t _f + !insertmacro _> `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + ; Unsigned integer tests (NB: no need for extra equality tests) + !macro _U< _a _b _t _f + IntCmpU `${_a}` `${_b}` `${_f}` `${_t}` `${_f}` + !macroend + + !macro _U>= _a _b _t _f + !insertmacro _U< `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + !macro _U> _a _b _t _f + IntCmpU `${_a}` `${_b}` `${_f}` `${_f}` `${_t}` + !macroend + + !macro _U<= _a _b _t _f + !insertmacro _U> `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + ; Int64 tests + !macro _Int64Cmp _a _o _b _t _f + !insertmacro _LOGICLIB_TEMP + System::Int64Op `${_a}` `${_o}` `${_b}` + Pop $_LOGICLIB_TEMP + !insertmacro _= $_LOGICLIB_TEMP 0 `${_f}` `${_t}` + !macroend + + !macro _L= _a _b _t _f + !insertmacro _Int64Cmp `${_a}` = `${_b}` `${_t}` `${_f}` + !macroend + + !macro _L<> _a _b _t _f + !insertmacro _L= `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + !macro _L< _a _b _t _f + !insertmacro _Int64Cmp `${_a}` < `${_b}` `${_t}` `${_f}` + !macroend + + !macro _L>= _a _b _t _f + !insertmacro _L< `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + !macro _L> _a _b _t _f + !insertmacro _Int64Cmp `${_a}` > `${_b}` `${_t}` `${_f}` + !macroend + + !macro _L<= _a _b _t _f + !insertmacro _L> `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + ; Flag tests + !macro _Abort _a _b _t _f + IfAbort `${_t}` `${_f}` + !macroend + !define Abort `"" Abort ""` + + !macro _Errors _a _b _t _f + IfErrors `${_t}` `${_f}` + !macroend + !define Errors `"" Errors ""` + + !macro _FileExists _a _b _t _f + IfFileExists `${_b}` `${_t}` `${_f}` + !macroend + !define FileExists `"" FileExists` + + !macro _RebootFlag _a _b _t _f + IfRebootFlag `${_t}` `${_f}` + !macroend + !define RebootFlag `"" RebootFlag ""` + + !macro _Silent _a _b _t _f + IfSilent `${_t}` `${_f}` + !macroend + !define Silent `"" Silent ""` + + ; "Any instruction" test + !macro _Cmd _a _b _t _f + !define _t=${_t} + !ifdef _t= ; If no true label then make one + !define __t _LogicLib_Label_${LOGICLIB_COUNTER} + !insertmacro _IncreaseCounter + !else + !define __t ${_t} + !endif + ${_b} ${__t} + !define _f=${_f} + !ifndef _f= ; If a false label then go there + Goto ${_f} + !endif + !undef _f=${_f} + !ifdef _t= ; If we made our own true label then place it + ${__t}: + !endif + !undef __t + !undef _t=${_t} + !macroend + !define Cmd `"" Cmd` + + ; Section flag test + !macro _SectionFlagIsSet _a _b _t _f + !insertmacro _LOGICLIB_TEMP + SectionGetFlags `${_b}` $_LOGICLIB_TEMP + IntOp $_LOGICLIB_TEMP $_LOGICLIB_TEMP & `${_a}` + !insertmacro _= $_LOGICLIB_TEMP `${_a}` `${_t}` `${_f}` + !macroend + !define SectionIsSelected `${SF_SELECTED} SectionFlagIsSet` + !define SectionIsSubSection `${SF_SUBSEC} SectionFlagIsSet` + !define SectionIsSubSectionEnd `${SF_SUBSECEND} SectionFlagIsSet` + !define SectionIsSectionGroup `${SF_SECGRP} SectionFlagIsSet` + !define SectionIsSectionGroupEnd `${SF_SECGRPEND} SectionFlagIsSet` + !define SectionIsBold `${SF_BOLD} SectionFlagIsSet` + !define SectionIsReadOnly `${SF_RO} SectionFlagIsSet` + !define SectionIsExpanded `${SF_EXPAND} SectionFlagIsSet` + !define SectionIsPartiallySelected `${SF_PSELECTED} SectionFlagIsSet` + + !define IfCmd `!insertmacro _IfThen "" Cmd ${|}` + + !macro _If _c _a _o _b + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !insertmacro _PushLogic + !define ${_Logic}If + !define ${_Logic}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the Else + !insertmacro _IncreaseCounter + !define _c=${_c} + !ifdef _c=true ; If is true + !insertmacro _${_o} `${_a}` `${_b}` "" ${${_Logic}Else} + !else ; If condition is false + !insertmacro _${_o} `${_a}` `${_b}` ${${_Logic}Else} "" + !endif + !undef _c=${_c} + !verbose pop + !macroend + !define If `!insertmacro _If true` + !define Unless `!insertmacro _If false` + !define IfNot `!insertmacro _If false` + + !macro _And _c _a _o _b + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _Logic | ${_Logic}If + !error "Cannot use And without a preceding If or IfNot/Unless" + !endif + !ifndef ${_Logic}Else + !error "Cannot use And following an Else" + !endif + !define _c=${_c} + !ifdef _c=true ; If is true + !insertmacro _${_o} `${_a}` `${_b}` "" ${${_Logic}Else} + !else ; If condition is false + !insertmacro _${_o} `${_a}` `${_b}` ${${_Logic}Else} "" + !endif + !undef _c=${_c} + !verbose pop + !macroend + !define AndIf `!insertmacro _And true` + !define AndUnless `!insertmacro _And false` + !define AndIfNot `!insertmacro _And false` + + !macro _Or _c _a _o _b + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _Logic | ${_Logic}If + !error "Cannot use Or without a preceding If or IfNot/Unless" + !endif + !ifndef ${_Logic}Else + !error "Cannot use Or following an Else" + !endif + !define _label _LogicLib_Label_${LOGICLIB_COUNTER} ; Skip this test as we already + !insertmacro _IncreaseCounter + Goto ${_label} ; have a successful result + ${${_Logic}Else}: ; Place the Else label + !undef ${_Logic}Else ; and remove it + !define ${_Logic}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new If + !insertmacro _IncreaseCounter + !define _c=${_c} + !ifdef _c=true ; If is true + !insertmacro _${_o} `${_a}` `${_b}` "" ${${_Logic}Else} + !else ; If condition is false + !insertmacro _${_o} `${_a}` `${_b}` ${${_Logic}Else} "" + !endif + !undef _c=${_c} + ${_label}: + !undef _label + !verbose pop + !macroend + !define OrIf `!insertmacro _Or true` + !define OrUnless `!insertmacro _Or false` + !define OrIfNot `!insertmacro _Or false` + + !macro _Else + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _Logic | ${_Logic}If + !error "Cannot use Else without a preceding If or IfNot/Unless" + !endif + !ifndef ${_Logic}Else + !error "Cannot use Else following an Else" + !endif + !ifndef ${_Logic}EndIf ; First Else for this If? + !define ${_Logic}EndIf _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the EndIf + !insertmacro _IncreaseCounter + !endif + Goto ${${_Logic}EndIf} ; Go to the EndIf + ${${_Logic}Else}: ; Place the Else label + !undef ${_Logic}Else ; and remove it + !verbose pop + !macroend + !define Else `!insertmacro _Else` + + !macro _ElseIf _c _a _o _b + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${Else} ; Perform the Else + !define ${_Logic}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new If + !insertmacro _IncreaseCounter + !define _c=${_c} + !ifdef _c=true ; If is true + !insertmacro _${_o} `${_a}` `${_b}` "" ${${_Logic}Else} + !else ; If condition is false + !insertmacro _${_o} `${_a}` `${_b}` ${${_Logic}Else} "" + !endif + !undef _c=${_c} + !verbose pop + !macroend + !define ElseIf `!insertmacro _ElseIf true` + !define ElseUnless `!insertmacro _ElseIf false` + !define ElseIfNot `!insertmacro _ElseIf false` + + !macro _EndIf _n + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _Logic | ${_Logic}If + !error "Cannot use End${_n} without a preceding If or IfNot/Unless" + !endif + !ifdef ${_Logic}Else + ${${_Logic}Else}: ; Place the Else label + !undef ${_Logic}Else ; and remove it + !endif + !ifdef ${_Logic}EndIf + ${${_Logic}EndIf}: ; Place the EndIf + !undef ${_Logic}EndIf ; and remove it + !endif + !undef ${_Logic}If + !insertmacro _PopLogic + !verbose pop + !macroend + !define EndIf `!insertmacro _EndIf If` + !define EndUnless `!insertmacro _EndIf Unless` + + !macro _IfThen _a _o _b _t + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${If} `${_a}` `${_o}` `${_b}` + ${_t} + ${EndIf} + !verbose pop + !macroend + !define IfThen `!insertmacro _IfThen` + + !macro _IfNotThen _a _o _b _t + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${IfNot} `${_a}` `${_o}` `${_b}` + ${_t} + ${EndIf} + !verbose pop + !macroend + !define IfNotThen `!insertmacro _IfNotThen` + + !macro _ForEach _v _f _t _o _s + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + StrCpy "${_v}" "${_f}" ; Assign the initial value + Goto +2 ; Skip the loop expression for the first iteration + !define _DoLoopExpression `IntOp "${_v}" "${_v}" "${_o}" "${_s}"` ; Define the loop expression + !define _o=${_o} + !ifdef _o=+ ; Check the loop expression operator + !define __o > ; to determine the correct loop condition + !else ifdef _o=- + !define __o < + !else + !error "Unsupported ForEach step operator (must be + or -)" + !endif + !undef _o=${_o} + !insertmacro _Do For false `${_v}` `${__o}` `${_t}` ; Let Do do the rest + !undef __o + !verbose pop + !macroend + !define ForEach `!insertmacro _ForEach` + + !macro _For _v _f _t + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${ForEach} `${_v}` `${_f}` `${_t}` + 1 ; Pass on to ForEach + !verbose pop + !macroend + !define For `!insertmacro _For` + + !define ExitFor `!insertmacro _Goto ExitFor For` + + !define Next `!insertmacro _Loop For Next "" "" "" ""` + + !define While `!insertmacro _Do While true` + + !define ExitWhile `!insertmacro _Goto ExitWhile While` + + !define EndWhile `!insertmacro _Loop While EndWhile "" "" "" ""` + + !macro _Do _n _c _a _o _b + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !insertmacro _PushLogic + !define ${_Logic}${_n} _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the start of the loop + !insertmacro _IncreaseCounter + ${${_Logic}${_n}}: + !insertmacro _PushScope Exit${_n} _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the end of the loop + !insertmacro _IncreaseCounter + !insertmacro _PushScope Break ${_Exit${_n}} ; Break goes to the end of the loop + !ifdef _DoLoopExpression + ${_DoLoopExpression} ; Special extra parameter for inserting code + !undef _DoLoopExpression ; between the Continue label and the loop condition + !endif + !define _c=${_c} + !ifdef _c= ; No starting condition + !insertmacro _PushScope Continue _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for Continue at the end of the loop + !insertmacro _IncreaseCounter + !else + !insertmacro _PushScope Continue ${${_Logic}${_n}} ; Continue goes to the start of the loop + !ifdef _c=true ; If is true + !insertmacro _${_o} `${_a}` `${_b}` "" ${_Exit${_n}} + !else ; If condition is false + !insertmacro _${_o} `${_a}` `${_b}` ${_Exit${_n}} "" + !endif + !endif + !undef _c=${_c} + !define ${_Logic}Condition ${_c} ; Remember the condition used + !verbose pop + !macroend + !define Do `!insertmacro _Do Do "" "" "" ""` + !define DoWhile `!insertmacro _Do Do true` + !define DoUntil `!insertmacro _Do Do false` + + !macro _Goto _n _s + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _${_n} + !error "Cannot use ${_n} without a preceding ${_s}" + !endif + Goto ${_${_n}} + !verbose pop + !macroend + !define ExitDo `!insertmacro _Goto ExitDo Do` + + !macro _Loop _n _e _c _a _o _b + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _Logic | ${_Logic}${_n} + !error "Cannot use ${_e} without a preceding ${_n}" + !endif + !define _c=${${_Logic}Condition} + !ifdef _c= ; If Do had no condition place the Continue label + ${_Continue}: + !endif + !undef _c=${${_Logic}Condition} + !define _c=${_c} + !ifdef _c= ; No ending condition + Goto ${${_Logic}${_n}} + !else ifdef _c=true ; If condition is true + !insertmacro _${_o} `${_a}` `${_b}` ${${_Logic}${_n}} ${_Exit${_n}} + !else ; If condition is false + !insertmacro _${_o} `${_a}` `${_b}` ${_Exit${_n}} ${${_Logic}${_n}} + !endif + !undef _c=${_c} + Goto ${_Continue} ; Just to ensure it is referenced at least once + Goto ${_Exit${_n}} ; Just to ensure it is referenced at least once + ${_Exit${_n}}: ; Place the loop exit point + !undef ${_Logic}Condition + !insertmacro _PopScope Continue + !insertmacro _PopScope Break + !insertmacro _PopScope Exit${_n} + !undef ${_Logic}${_n} + !insertmacro _PopLogic + !verbose pop + !macroend + !define Loop `!insertmacro _Loop Do Loop "" "" "" ""` + !define LoopWhile `!insertmacro _Loop Do LoopWhile true` + !define LoopUntil `!insertmacro _Loop Do LoopUntil false` + + !define Continue `!insertmacro _Goto Continue "For or Do or While"` + !define Break `!insertmacro _Goto Break "For or Do or While"` + + !macro _Select _a + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !insertmacro _PushLogic + !define ${_Logic}Select `${_a}` ; Remember the left hand side of the comparison + !verbose pop + !macroend + !define Select `!insertmacro _Select` + + !macro _Select_CaseElse + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _Logic | ${_Logic}Select + !error "Cannot use Case without a preceding Select" + !endif + !ifdef ${_Logic}EndSelect ; This is set only after the first case + !ifndef ${_Logic}Else + !error "Cannot use Case following a CaseElse" + !endif + Goto ${${_Logic}EndSelect} ; Go to the EndSelect + ${${_Logic}Else}: ; Place the Else label + !undef ${_Logic}Else ; and remove it + !else + !define ${_Logic}EndSelect _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the EndSelect + !insertmacro _IncreaseCounter + !endif + !verbose pop + !macroend + !define CaseElse `!insertmacro _CaseElse` + !define Case_Else `!insertmacro _CaseElse` ; Compatibility with 2.2 and earlier + !define Default `!insertmacro _CaseElse` ; For the C-minded + + !macro _Select_Case _a + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${CaseElse} ; Perform the CaseElse + !define ${_Logic}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case + !insertmacro _IncreaseCounter + !insertmacro _== `${${_Logic}Select}` `${_a}` "" ${${_Logic}Else} + !verbose pop + !macroend + !define Case `!insertmacro _Case` + + !macro _Case2 _a _b + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${CaseElse} ; Perform the CaseElse + !define ${_Logic}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case + !insertmacro _IncreaseCounter + !insertmacro _== `${${_Logic}Select}` `${_a}` +2 "" + !insertmacro _== `${${_Logic}Select}` `${_b}` "" ${${_Logic}Else} + !verbose pop + !macroend + !define Case2 `!insertmacro _Case2` + + !macro _Case3 _a _b _c + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${CaseElse} ; Perform the CaseElse + !define ${_Logic}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case + !insertmacro _IncreaseCounter + !insertmacro _== `${${_Logic}Select}` `${_a}` +3 "" + !insertmacro _== `${${_Logic}Select}` `${_b}` +2 "" + !insertmacro _== `${${_Logic}Select}` `${_c}` "" ${${_Logic}Else} + !verbose pop + !macroend + !define Case3 `!insertmacro _Case3` + + !macro _Case4 _a _b _c _d + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${CaseElse} ; Perform the CaseElse + !define ${_Logic}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case + !insertmacro _IncreaseCounter + !insertmacro _== `${${_Logic}Select}` `${_a}` +4 "" + !insertmacro _== `${${_Logic}Select}` `${_b}` +3 "" + !insertmacro _== `${${_Logic}Select}` `${_c}` +2 "" + !insertmacro _== `${${_Logic}Select}` `${_d}` "" ${${_Logic}Else} + !verbose pop + !macroend + !define Case4 `!insertmacro _Case4` + + !macro _Case5 _a _b _c _d _e + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${CaseElse} ; Perform the CaseElse + !define ${_Logic}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case + !insertmacro _IncreaseCounter + !insertmacro _== `${${_Logic}Select}` `${_a}` +5 "" + !insertmacro _== `${${_Logic}Select}` `${_b}` +4 "" + !insertmacro _== `${${_Logic}Select}` `${_c}` +3 "" + !insertmacro _== `${${_Logic}Select}` `${_d}` +2 "" + !insertmacro _== `${${_Logic}Select}` `${_e}` "" ${${_Logic}Else} + !verbose pop + !macroend + !define Case5 `!insertmacro _Case5` + + !macro _EndSelect + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _Logic | ${_Logic}Select + !error "Cannot use EndSelect without a preceding Select" + !endif + !ifdef ${_Logic}Else + ${${_Logic}Else}: ; Place the Else label + !undef ${_Logic}Else ; and remove it + !endif + !ifdef ${_Logic}EndSelect ; This won't be set if there weren't any cases + ${${_Logic}EndSelect}: ; Place the EndSelect + !undef ${_Logic}EndSelect ; and remove it + !endif + !undef ${_Logic}Select + !insertmacro _PopLogic + !verbose pop + !macroend + !define EndSelect `!insertmacro _EndSelect` + + !macro _Switch _a + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !insertmacro _PushLogic + !insertmacro _PushScope Switch ${_Logic} ; Keep a separate stack for switch data + !insertmacro _PushScope Break _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a lable for beyond the end of the switch + !insertmacro _IncreaseCounter + !define ${_Switch}Var `${_a}` ; Remember the left hand side of the comparison + !tempfile ${_Switch}Tmp ; Create a temporary file + !define ${_Logic}Switch _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the end of the switch + !insertmacro _IncreaseCounter + Goto ${${_Logic}Switch} ; and go there + !verbose pop + !macroend + !define Switch `!insertmacro _Switch` + + !macro _Case _a + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifdef _Logic & ${_Logic}Select ; Check for an active Select + !insertmacro _Select_Case `${_a}` + !else ifndef _Switch ; If not then check for an active Switch + !error "Cannot use Case without a preceding Select or Switch" + !else + !define _label _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for this case, + !insertmacro _IncreaseCounter + ${_label}: ; place it and add it's check to the temp file + !appendfile "${${_Switch}Tmp}" `!insertmacro _== $\`${${_Switch}Var}$\` $\`${_a}$\` ${_label} ""$\n` + !undef _label + !endif + !verbose pop + !macroend + + !macro _CaseElse + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifdef _Logic & ${_Logic}Select ; Check for an active Select + !insertmacro _Select_CaseElse + !else ifndef _Switch ; If not then check for an active Switch + !error "Cannot use Case without a preceding Select or Switch" + !else ifdef ${_Switch}Else ; Already had a default case? + !error "Cannot use CaseElse following a CaseElse" + !else + !define ${_Switch}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the default case, + !insertmacro _IncreaseCounter + ${${_Switch}Else}: ; and place it + !endif + !verbose pop + !macroend + + !macro _EndSwitch + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _Logic | ${_Logic}Switch + !error "Cannot use EndSwitch without a preceding Switch" + !endif + Goto ${_Break} ; Skip the jump table + ${${_Logic}Switch}: ; Place the end of the switch + !undef ${_Logic}Switch + !include "${${_Switch}Tmp}" ; Include the jump table + !delfile "${${_Switch}Tmp}" ; and clear it up + !ifdef ${_Switch}Else ; Was there a default case? + Goto ${${_Switch}Else} ; then go there if all else fails + !undef ${_Switch}Else + !endif + !undef ${_Switch}Tmp + !undef ${_Switch}Var + ${_Break}: ; Place the break label + !insertmacro _PopScope Break + !insertmacro _PopScope Switch + !insertmacro _PopLogic + !verbose pop + !macroend + !define EndSwitch `!insertmacro _EndSwitch` + +!endif ; LOGICLIB +!verbose 3 +!define LOGICLIB_VERBOSITY ${_LOGICLIB_VERBOSITY} +!undef _LOGICLIB_VERBOSITY +!verbose pop diff --git a/scripts/installer.nsi b/scripts/installer.nsi index 1841431..2cbd6d3 100644 --- a/scripts/installer.nsi +++ b/scripts/installer.nsi @@ -1,7 +1,10 @@ +InstallDir "" +!include "LogicLib.nsh" !include "mingw-file-association.nsh" +!include "x64.nsh" Name "OpenSCAD" OutFile "openscad_setup.exe" -InstallDir $PROGRAMFILES\OpenSCAD +!include "installer_arch.nsi" DirText "This will install OpenSCAD on your computer. Choose a directory" Section "install" SetOutPath $INSTDIR diff --git a/scripts/installer32.nsi b/scripts/installer32.nsi new file mode 100644 index 0000000..051cb0e --- /dev/null +++ b/scripts/installer32.nsi @@ -0,0 +1,3 @@ +Function .onInit + StrCpy $InstDir $PROGRAMFILES\OpenSCAD +FunctionEnd diff --git a/scripts/installer64.nsi b/scripts/installer64.nsi new file mode 100644 index 0000000..1b24c0c --- /dev/null +++ b/scripts/installer64.nsi @@ -0,0 +1,8 @@ +Function .onInit +${If} ${RunningX64} + StrCpy $InstDir $PROGRAMFILES64\OpenSCAD + SetRegView 64 +${Else} + Messagebox MB_OK "This is 64 bit OpenSCAD, your machine is 32 bits. Error." +${EndIf} +FunctionEnd diff --git a/scripts/mingw-x-build-dependencies.sh b/scripts/mingw-x-build-dependencies.sh index 7a16530..03adc22 100755 --- a/scripts/mingw-x-build-dependencies.sh +++ b/scripts/mingw-x-build-dependencies.sh @@ -1,11 +1,13 @@ #!/bin/sh -e # # This script builds all library dependencies of OpenSCAD for cross-compilation -# from linux to mingw32 for windows, using the MXE cross build system. +# from linux to mingw32/64 for windows, using the MXE cross build system. # # This script must be run from the OpenSCAD source root directory # -# Usage: ./scripts/mingw-x-build-dependencies.sh +# Usage: +# ./scripts/mingw-x-build-dependencies.sh # 32 bit +# ./scripts/mingw-x-build-dependencies.sh 64 # 64 bit # # Prerequisites: # @@ -13,6 +15,8 @@ # # Also see http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Cross-compiling_for_Windows_on_Linux_or_Mac_OS_X # +# Also note the 64 bit is built on the branch of mxe by Tony Theodore +# which hasnt been merged to official mxe as of writing OPENSCADDIR=$PWD if [ ! -f $OPENSCADDIR/openscad.pro ]; then @@ -34,7 +38,7 @@ if [ ! $NUMJOBS ]; then fi fi -. ./scripts/setenv-mingw-xbuild.sh +. ./scripts/setenv-mingw-xbuild.sh $* if [ ! -e $BASEDIR ]; then mkdir -p $BASEDIR @@ -44,7 +48,11 @@ if [ ! -e $MXEDIR ]; then mkdir -p $MXEDIR cd $MXEDIR/.. echo "Downloading MXE into " $PWD - git clone git://github.com/mxe/mxe.git + if [ `echo $* | grep 64` ]; then + git clone -b multi-rebase git://github.com/tonytheodore/mxe.git ./mxe-w64 + else + git clone git://github.com/mxe/mxe.git + fi fi echo "entering" $MXEDIR diff --git a/scripts/release-common.sh b/scripts/release-common.sh index 02b276b..035fa3f 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -7,11 +7,12 @@ # The script will create a file called openscad-. in # the current directory (or under ./mingw32) # -# Usage: release-common.sh [-v ] [-c] [-x32] +# Usage: release-common.sh [-v ] [-c] [-mingw[32|64]] # -v Version string (e.g. -v 2010.01) # -d Version date (e.g. -d 2010.01.23) # -c Build with commit info # -mingw32 Cross-compile for win32 using MXE +# -mingw64 Cross-compile for win64 using MXE # # If no version string or version date is given, todays date will be used (YYYY-MM-DD) # If only verion date is given, it will be used also as version string. @@ -20,7 +21,7 @@ # The commit info will extracted from git and be passed to qmake as OPENSCAD_COMMIT # to identify a build in the about box. # -# The mingw32 cross compile depends on the MXE cross-build tools. Please +# The mingw cross compile depends on the MXE cross-build tools. Please # see the README.md file on how to install these dependencies. printUsage() @@ -52,6 +53,12 @@ fi if [ "`echo $* | grep mingw32`" ]; then OS=LINXWIN + ARCH=32 +fi + +if [ "`echo $* | grep mingw64`" ]; then + OS=LINXWIN + ARCH=64 fi if [ $OS ]; then @@ -83,7 +90,6 @@ echo "Checking pre-requisites..." case $OS in LINXWIN) MAKENSIS= - if [ "`command -v makensis`" ]; then MAKENSIS=makensis elif [ "`command -v i686-pc-mingw32-makensis`" ]; then @@ -124,7 +130,7 @@ case $OS in TARGET=release ;; LINXWIN) - . ./scripts/setenv-mingw-xbuild.sh + . ./scripts/setenv-mingw-xbuild.sh $ARCH TARGET=release ZIP="zip" ZIPARGS="-r" @@ -170,13 +176,12 @@ fi case $OS in LINXWIN) - # dont use paralell builds, it can error-out on parser_yacc. - + # make || make enables paralell builds, thanks Tony Theodore # make main openscad.exe cd $DEPLOYDIR - make $TARGET ## comment out for test-run + make $TARGET -j$NUMCPU || make $TARGET -j $NUMCPU ## comment 4 test if [ ! -e $TARGET/openscad.exe ]; then - echo 'build failed. stopping.' + echo "cant find $TARGET/openscad.exe. build failed. stopping." exit fi # make console pipe-able openscad.com - see winconsole.pri for info @@ -271,8 +276,11 @@ case $OS in echo "Creating installer" echo "Copying NSIS files to $DEPLOYDIR/openscad-$VERSION" - cp ./scripts/installer.nsi $DEPLOYDIR/openscad-$VERSION - cp ./scripts/mingw-file-association.nsh $DEPLOYDIR/openscad-$VERSION + cp ./scripts/installer$ARCH.nsi $DEPLOYDIR/openscad-$VERSION/installer_arch.nsi + cp ./scripts/installer.nsi $DEPLOYDIR/openscad-$VERSION/ + cp ./scripts/mingw-file-association.nsh $DEPLOYDIR/openscad-$VERSION/ + cp ./scripts/x64.nsh $DEPLOYDIR/openscad-$VERSION/ + cp ./scripts/LogicLib.nsh $DEPLOYDIR/openscad-$VERSION/ cd $DEPLOYDIR/openscad-$VERSION NSISDEBUG=-V2 # NSISDEBUG= # leave blank for full log @@ -288,12 +296,11 @@ case $OS in echo "Installer created:" $INSTFILE echo else - echo "Build failed. Cannot find" $INSTFILE - exit 1 + echo "Build failed. Cannot find" $INSTFILE fi else - echo "Build failed. Cannot find" $BINFILE - exit 1 + echo "Build failed. Cannot find" $BINFILE + exit 1 fi ;; LINUX) diff --git a/scripts/setenv-mingw-xbuild.sh b/scripts/setenv-mingw-xbuild.sh index e31534e..b6fa156 100644 --- a/scripts/setenv-mingw-xbuild.sh +++ b/scripts/setenv-mingw-xbuild.sh @@ -2,7 +2,10 @@ # # set environment variables for mingw/mxe cross-build # -# Usage: source ./scripts/setenv-mingw-xbuild.sh +# Usage: +# +# source ./scripts/setenv-mingw-xbuild.sh # 32 bit build +# source ./scripts/setenv-mingw-xbuild.sh 64 # 64 bit build # # Prerequisites: # @@ -18,11 +21,20 @@ if [ ! $BASEDIR ]; then fi if [ ! $DEPLOYDIR ]; then - export DEPLOYDIR=$OPENSCADDIR/mingw32 + if [ `echo $* | grep 64 ` ]; then + DEPLOYDIR=$OPENSCADDIR/mingw64 + else + DEPLOYDIR=$OPENSCADDIR/mingw32 + fi + export DEPLOYDIR fi if [ ! $MXEDIR ]; then - export MXEDIR=$BASEDIR/mxe + if [ `echo $* | grep 64 ` ]; then + export MXEDIR=$BASEDIR/mxe-w64 + else + export MXEDIR=$BASEDIR/mxe + fi fi export PATH=$MXEDIR/usr/bin:$PATH @@ -31,16 +43,21 @@ if [ ! -e $DEPLOYDIR ]; then mkdir -p $DEPLOYDIR fi -echo linking $MXEDIR/usr/i686-pc-mingw32/ to $DEPLOYDIR/mingw-cross-env +if [ `echo $* | grep 64 ` ]; then + MXETARGETDIR=$MXEDIR/usr/x86_64-w64-mingw32 +else + MXETARGETDIR=$MXEDIR/usr/i686-pc-mingw32 +fi +echo linking $MXETARGETDIR to $DEPLOYDIR/mingw-cross-env rm -f $DEPLOYDIR/mingw-cross-env -ln -s $MXEDIR/usr/i686-pc-mingw32/ $DEPLOYDIR/mingw-cross-env -export PATH=$MXEDIR/usr/i686-pc-mingw32/qt/bin:$PATH +ln -s $MXETARGETDIR $DEPLOYDIR/mingw-cross-env +export PATH=$MXETARGETDIR/qt/bin:$PATH echo BASEDIR: $BASEDIR echo MXEDIR: $MXEDIR echo DEPLOYDIR: $DEPLOYDIR echo PATH modified: $MXEDIR/usr/bin -echo PATH modified: $MXEDIR/usr/i686-pc-mingw32/qt/bin +echo PATH modified: $MXETARGETDIR/qt/bin diff --git a/scripts/x64.nsh b/scripts/x64.nsh new file mode 100644 index 0000000..e694c1e --- /dev/null +++ b/scripts/x64.nsh @@ -0,0 +1,54 @@ +; --------------------- +; x64.nsh +; --------------------- +; +; A few simple macros to handle installations on x64 machines. +; +; RunningX64 checks if the installer is running on x64. +; +; ${If} ${RunningX64} +; MessageBox MB_OK "running on x64" +; ${EndIf} +; +; DisableX64FSRedirection disables file system redirection. +; EnableX64FSRedirection enables file system redirection. +; +; SetOutPath $SYSDIR +; ${DisableX64FSRedirection} +; File some.dll # extracts to C:\Windows\System32 +; ${EnableX64FSRedirection} +; File some.dll # extracts to C:\Windows\SysWOW64 +; + +!ifndef ___X64__NSH___ +!define ___X64__NSH___ + +!include LogicLib.nsh + +!macro _RunningX64 _a _b _t _f + !insertmacro _LOGICLIB_TEMP + System::Call kernel32::GetCurrentProcess()i.s + System::Call kernel32::IsWow64Process(is,*i.s) + Pop $_LOGICLIB_TEMP + !insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}` +!macroend + +!define RunningX64 `"" RunningX64 ""` + +!macro DisableX64FSRedirection + + System::Call kernel32::Wow64EnableWow64FsRedirection(i0) + +!macroend + +!define DisableX64FSRedirection "!insertmacro DisableX64FSRedirection" + +!macro EnableX64FSRedirection + + System::Call kernel32::Wow64EnableWow64FsRedirection(i1) + +!macroend + +!define EnableX64FSRedirection "!insertmacro EnableX64FSRedirection" + +!endif # !___X64__NSH___ diff --git a/src/mainwin.cc b/src/mainwin.cc index 5f9d633..da3501d 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -1765,6 +1765,12 @@ void MainWindow::helpLibrary() OPENCSG_VERSION_STRING, qVersion()); +#if defined( __MINGW64__ ) + libinfo += QString("Compiled for MingW64\n\n"); +#elif defined( __MINGW32__ ) + libinfo += QString("Compiled for MingW32\n\n"); +#endif + if (!this->openglbox) { this->openglbox = new QMessageBox(QMessageBox::Information, "OpenGL Info", "OpenSCAD Detailed Library Info ", -- cgit v0.10.1 From be87d30f427a4ffff8a21c3871e0304670443710 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Thu, 16 May 2013 22:59:58 -0500 Subject: enable both win32 and win64 build and upload (beta level) from same script diff --git a/scripts/builder.sh b/scripts/builder.sh index 75b80f8..e8876e8 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -6,10 +6,6 @@ # requirements - # see http://mxe.cc for required tools (scons, perl, yasm, etc etc etc) -# todo - auto update webpage to link to proper snapshot -# -# todo - 64 bit windows (needs mxe 64 bit stable) -# # todo - can we build 32 bit linux from within 64 bit linux? # # todo - make linux work @@ -36,14 +32,23 @@ get_source_code() build_win32() { + . ./scripts/setenv-mingw-xbuild.sh clean . ./scripts/setenv-mingw-xbuild.sh ./scripts/mingw-x-build-dependencies.sh ./scripts/release-common.sh mingw32 } +build_win64() +{ + . ./scripts/setenv-mingw-xbuild.sh clean + . ./scripts/setenv-mingw-xbuild.sh 64 + ./scripts/mingw-x-build-dependencies.sh 64 + ./scripts/release-common.sh mingw64 +} + build_lin32() { - . ./scripts/setenv-unibuild.sh clang + . ./scripts/setenv-unibuild.sh ./scripts/uni-build-dependencies.sh ./scripts/release-common.sh } @@ -87,6 +92,26 @@ upload_win32() export WIN32_PACKAGEFILE2_SIZE } +upload_win64() +{ + SUMMARY1="Windows x86-64 Snapshot Zipfile" + SUMMARY2="Windows x86-64 Snapshot Installer" + DATECODE=`date +"%Y.%m.%d"` + BASEDIR=./mingw64/ + WIN64_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-64.zip + WIN64_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-64-Installer.exe + upload_win_generic "$SUMMARY1" $USERNAME $BASEDIR/$WIN64_PACKAGEFILE1 + upload_win_generic "$SUMMARY2" $USERNAME $BASEDIR/$WIN64_PACKAGEFILE2 + export WIN64_PACKAGEFILE1 + export WIN64_PACKAGEFILE2 + WIN64_PACKAGEFILE1_SIZE=`ls -sh $BASEDIR/$WIN64_PACKAGEFILE1 | awk ' {print $1} ';` + WIN64_PACKAGEFILE2_SIZE=`ls -sh $BASEDIR/$WIN64_PACKAGEFILE2 | awk ' {print $1} ';` + WIN64_PACKAGEFILE1_SIZE=`echo "$WIN64_PACKAGEFILE1_SIZE""B"` + WIN64_PACKAGEFILE2_SIZE=`echo "$WIN64_PACKAGEFILE2_SIZE""B"` + export WIN64_PACKAGEFILE1_SIZE + export WIN64_PACKAGEFILE2_SIZE +} + read_username_from_user() { echo 'Please enter your username for https://code.google.com/hosting/settings' @@ -112,7 +137,7 @@ read_password_from_user() export OSUPL_PASSWORD } -update_www_download_links() +update_win_www_download_links() { cd $STARTPATH git clone git@github.com:openscad/openscad.github.com.git @@ -123,6 +148,13 @@ update_www_download_links() DATECODE=`date +"%Y.%m.%d"` rm win_snapshot_links.js + echo "snapinfo['WIN64_SNAPSHOT1_URL'] = '$BASEURL$WIN64_PACKAGEFILE1'" >> win_snapshot_links.js + echo "snapinfo['WIN64_SNAPSHOT2_URL'] = '$BASEURL$WIN64_PACKAGEFILE2'" >> win_snapshot_links.js + echo "snapinfo['WIN64_SNAPSHOT1_NAME'] = 'OpenSCAD $DATECODE'" >> win_snapshot_links.js + echo "snapinfo['WIN64_SNAPSHOT2_NAME'] = 'OpenSCAD $DATECODE'" >> win_snapshot_links.js + echo "snapinfo['WIN64_SNAPSHOT1_SIZE'] = '$WIN64_PACKAGEFILE1_SIZE'" >> win_snapshot_links.js + echo "snapinfo['WIN64_SNAPSHOT2_SIZE'] = '$WIN64_PACKAGEFILE2_SIZE'" >> win_snapshot_links.js + echo "snapinfo['WIN32_SNAPSHOT1_URL'] = '$BASEURL$WIN32_PACKAGEFILE1'" >> win_snapshot_links.js echo "snapinfo['WIN32_SNAPSHOT2_URL'] = '$BASEURL$WIN32_PACKAGEFILE2'" >> win_snapshot_links.js echo "snapinfo['WIN32_SNAPSHOT1_NAME'] = 'OpenSCAD $DATECODE'" >> win_snapshot_links.js @@ -130,7 +162,6 @@ update_www_download_links() echo "snapinfo['WIN32_SNAPSHOT1_SIZE'] = '$WIN32_PACKAGEFILE1_SIZE'" >> win_snapshot_links.js echo "snapinfo['WIN32_SNAPSHOT2_SIZE'] = '$WIN32_PACKAGEFILE2_SIZE'" >> win_snapshot_links.js echo 'modified win_snapshot_links.js' - cat win_snapshot_links.js PAGER=cat git diff if [ ! $DRYRUN ]; then @@ -157,9 +188,12 @@ check_starting_path read_username_from_user read_password_from_user get_source_code + build_win32 +build_win64 upload_win32 -update_www_download_links +upload_win64 +update_win_www_download_links diff --git a/scripts/mingw-x-build-dependencies.sh b/scripts/mingw-x-build-dependencies.sh index 03adc22..168b847 100755 --- a/scripts/mingw-x-build-dependencies.sh +++ b/scripts/mingw-x-build-dependencies.sh @@ -48,7 +48,7 @@ if [ ! -e $MXEDIR ]; then mkdir -p $MXEDIR cd $MXEDIR/.. echo "Downloading MXE into " $PWD - if [ `echo $* | grep 64` ]; then + if [ "`echo $* | grep 64`" ]; then git clone -b multi-rebase git://github.com/tonytheodore/mxe.git ./mxe-w64 else git clone git://github.com/mxe/mxe.git @@ -57,9 +57,15 @@ fi echo "entering" $MXEDIR cd $MXEDIR -echo "make mpfr eigen opencsg cgal qt nsis -j $NUMCPU JOBS=$NUMJOBS" -make mpfr eigen opencsg cgal qt nsis -j $NUMCPU JOBS=$NUMJOBS -#make mpfr -j $NUMCPU JOBS=$NUMJOBS # for testing +if [ "`echo $* | grep 64`" ]; then + MXE_TARGETS='x86_64-w64-mingw32' + PACKAGES='mpfr eigen opencsg cgal qt' +else + MXE_TARGETS= + PACKAGES='mpfr eigen opencsg cgal qt nsis' +fi +echo make $PACKAGES MXE_TARGETS=$MXE_TARGETS -j $NUMCPU JOBS=$NUMJOBS +make $PACKAGES MXE_TARGETS=$MXE_TARGETS -j $NUMCPU JOBS=$NUMJOBS echo "leaving" $MXEDIR diff --git a/scripts/release-common.sh b/scripts/release-common.sh index 035fa3f..85b719c 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -116,6 +116,13 @@ fi echo "Building openscad-$VERSION ($VERSIONDATE) $CONFIGURATION..." +if [ ! $NUMCPU ]; then + echo "note: you can 'export NUMCPU=x' for multi-core compiles (x=number)"; + NUMCPU=2 +else + echo "NUMCPU: " $NUMCPU +fi + CONFIG=deploy case $OS in LINUX|MACOSX) @@ -169,17 +176,12 @@ case $OS in ;; esac -if [ ! $NUMCPU ]; then - echo "note: you can 'export NUMCPU=x' for multi-core compiles (x=number)"; - NUMCPU=2 -fi - case $OS in LINXWIN) # make || make enables paralell builds, thanks Tony Theodore # make main openscad.exe cd $DEPLOYDIR - make $TARGET -j$NUMCPU || make $TARGET -j $NUMCPU ## comment 4 test + make $TARGET -j$NUMCPU || make $TARGET -j$NUMCPU ## comment 4 test if [ ! -e $TARGET/openscad.exe ]; then echo "cant find $TARGET/openscad.exe. build failed. stopping." exit diff --git a/scripts/setenv-mingw-xbuild.sh b/scripts/setenv-mingw-xbuild.sh index b6fa156..15449ce 100644 --- a/scripts/setenv-mingw-xbuild.sh +++ b/scripts/setenv-mingw-xbuild.sh @@ -14,50 +14,82 @@ # Also see http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Cross-compiling_for_Windows_on_Linux_or_Mac_OS_X # -export OPENSCADDIR=$PWD +OPENSCADDIR=$PWD if [ ! $BASEDIR ]; then - export BASEDIR=$HOME/openscad_deps + BASEDIR=$HOME/openscad_deps fi +DEPLOYDIR64=$OPENSCADDIR/mingw64 +DEPLOYDIR32=$OPENSCADDIR/mingw32 + if [ ! $DEPLOYDIR ]; then - if [ `echo $* | grep 64 ` ]; then - DEPLOYDIR=$OPENSCADDIR/mingw64 + if [ "`echo $* | grep 64 `" ]; then + DEPLOYDIR=$DEPLOYDIR64 else - DEPLOYDIR=$OPENSCADDIR/mingw32 + DEPLOYDIR=$DEPLOYDIR32 fi - export DEPLOYDIR fi if [ ! $MXEDIR ]; then - if [ `echo $* | grep 64 ` ]; then - export MXEDIR=$BASEDIR/mxe-w64 + if [ "`echo $* | grep 64 `" ]; then + MXEDIR=$BASEDIR/mxe-w64 else - export MXEDIR=$BASEDIR/mxe + MXEDIR=$BASEDIR/mxe fi fi -export PATH=$MXEDIR/usr/bin:$PATH - if [ ! -e $DEPLOYDIR ]; then mkdir -p $DEPLOYDIR fi -if [ `echo $* | grep 64 ` ]; then +if [ "`echo $* | grep 64 `" ]; then MXETARGETDIR=$MXEDIR/usr/x86_64-w64-mingw32 else MXETARGETDIR=$MXEDIR/usr/i686-pc-mingw32 fi -echo linking $MXETARGETDIR to $DEPLOYDIR/mingw-cross-env -rm -f $DEPLOYDIR/mingw-cross-env -ln -s $MXETARGETDIR $DEPLOYDIR/mingw-cross-env -export PATH=$MXETARGETDIR/qt/bin:$PATH + +if [ ! $MINGWX_SAVED_ORIGINAL_PATH ]; then + MINGWX_SAVED_ORIGINAL_PATH=$PATH + echo current path saved +fi + +PATH=$MXEDIR/usr/bin:$PATH +PATH=$MXETARGETDIR/qt/bin:$PATH + + + + + +if [ "`echo $* | grep clean`" ]; then + BASEDIR= + MXEDIR= + MXETARGETDIR= + DEPLOYDIR= + PATH=$MINGWX_SAVED_ORIGINAL_PATH + MINGWX_SAVED_ORIGINAL_PATH= +else + echo 'linking' $MXETARGETDIR + echo ' to' $DEPLOYDIR/mingw-cross-env + rm -f $DEPLOYDIR/mingw-cross-env + ln -s $MXETARGETDIR $DEPLOYDIR/mingw-cross-env +fi + +export BASEDIR +export MXEDIR +export MXETARGETDIR +export DEPLOYDIR +export PATH +export MINGWX_SAVED_ORIGINAL_PATH echo BASEDIR: $BASEDIR echo MXEDIR: $MXEDIR +echo MXETARGETDIR: $MXETARGETDIR echo DEPLOYDIR: $DEPLOYDIR -echo PATH modified: $MXEDIR/usr/bin -echo PATH modified: $MXETARGETDIR/qt/bin - - +if [ "`echo $* | grep clean`" ]; then + echo PATH restored to pre-setenv-mingw-x state +else + echo PATH modified: $MXEDIR/usr/bin + echo PATH modified: $MXETARGETDIR/qt/bin +fi -- cgit v0.10.1 From b3b83059e7c62339712e71294662cd3fa883f0db Mon Sep 17 00:00:00 2001 From: Don Bright Date: Fri, 17 May 2013 15:32:23 -0500 Subject: tweaks to improve build. alos update about.html docs diff --git a/scripts/builder.sh b/scripts/builder.sh index e8876e8..7cd551e 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -12,11 +12,16 @@ # # todo - detect failure and stop -DRYRUN= +DRYRUN=1 -check_starting_path() +init_variables() { STARTPATH=$PWD + export STARTPATH +} + +check_starting_path() +{ if [ -e openscad.pro ]; then echo 'please start from a clean directory outside of openscad' exit @@ -36,6 +41,8 @@ build_win32() . ./scripts/setenv-mingw-xbuild.sh ./scripts/mingw-x-build-dependencies.sh ./scripts/release-common.sh mingw32 + DATECODE=`date +"%Y.%m.%d"` + export DATECODE } build_win64() @@ -44,6 +51,8 @@ build_win64() . ./scripts/setenv-mingw-xbuild.sh 64 ./scripts/mingw-x-build-dependencies.sh 64 ./scripts/release-common.sh mingw64 + DATECODE=`date +"%Y.%m.%d"` + export DATECODE } build_lin32() @@ -51,24 +60,29 @@ build_lin32() . ./scripts/setenv-unibuild.sh ./scripts/uni-build-dependencies.sh ./scripts/release-common.sh + DATECODE=`date +"%Y.%m.%d"` + export DATECODE } upload_win_generic() { - # 1=file summary, 2 = username, 3 = filename - if [ -e $3 ]; then - echo $3 found + summary="$1" + username=$2 + filename=$3 + if [ -f $filename ]; then + echo 'file "'$filename'" found' else - echo $3 not found + echo 'file "'$filename'" not found' fi opts= opts="$opts -p openscad" - opts="$opts -u $2" - opts="$opts $3" - if [ ! $DRYRUN ]; then - python ./scripts/googlecode_upload.py -s "$1" $opts - else + opts="$opts -u $username" + opts="$opts $filename" + if [ $DRYRUN ]; then echo dry run, not uploading to googlecode + echo cmd - python ./scripts/googlecode_upload.py -s '"'$summary'"' $opts + else + python ./scripts/googlecode_upload.py -s "$summary" $opts fi } @@ -76,7 +90,6 @@ upload_win32() { SUMMARY1="Windows x86-32 Snapshot Zipfile" SUMMARY2="Windows x86-32 Snapshot Installer" - DATECODE=`date +"%Y.%m.%d"` BASEDIR=./mingw32/ WIN32_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-32.zip WIN32_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-32-Installer.exe @@ -96,7 +109,6 @@ upload_win64() { SUMMARY1="Windows x86-64 Snapshot Zipfile" SUMMARY2="Windows x86-64 Snapshot Installer" - DATECODE=`date +"%Y.%m.%d"` BASEDIR=./mingw64/ WIN64_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-64.zip WIN64_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-64-Installer.exe @@ -114,6 +126,7 @@ upload_win64() read_username_from_user() { + if [ $DRYRUN ]; then USERNAME=none;export USERNAME; return; fi echo 'Please enter your username for https://code.google.com/hosting/settings' echo -n 'Username:' read USERNAME @@ -122,6 +135,7 @@ read_username_from_user() read_password_from_user() { + if [ $DRYRUN ]; then return; fi echo 'Please enter your password for https://code.google.com/hosting/settings' echo -n 'Password:' read -s PASSWORD1 @@ -145,7 +159,6 @@ update_win_www_download_links() cd inc echo `pwd` BASEURL='https://openscad.google.com/files/' - DATECODE=`date +"%Y.%m.%d"` rm win_snapshot_links.js echo "snapinfo['WIN64_SNAPSHOT1_URL'] = '$BASEURL$WIN64_PACKAGEFILE1'" >> win_snapshot_links.js @@ -174,6 +187,7 @@ update_win_www_download_links() check_ssh_agent() { + if [ $DRYRUN ]; then echo 'skipping ssh, dry run'; return; fi if [ ! $SSH_AUTH_SOCK ]; then echo 'please start an ssh-agent for github.com/openscad/openscad.github.com uploads' echo 'for example:' @@ -183,6 +197,7 @@ check_ssh_agent() fi } +init_variables check_ssh_agent check_starting_path read_username_from_user diff --git a/scripts/mingw-x-build-dependencies.sh b/scripts/mingw-x-build-dependencies.sh index 168b847..c3d5179 100755 --- a/scripts/mingw-x-build-dependencies.sh +++ b/scripts/mingw-x-build-dependencies.sh @@ -46,13 +46,13 @@ fi if [ ! -e $MXEDIR ]; then mkdir -p $MXEDIR - cd $MXEDIR/.. - echo "Downloading MXE into " $PWD - if [ "`echo $* | grep 64`" ]; then - git clone -b multi-rebase git://github.com/tonytheodore/mxe.git ./mxe-w64 - else - git clone git://github.com/mxe/mxe.git - fi +fi +cd $MXEDIR/.. +echo "Downloading MXE into " $PWD +if [ "`echo $* | grep 64`" ]; then + git clone -b multi-rebase git://github.com/tonytheodore/mxe.git ./mxe-w64 +else + git clone git://github.com/mxe/mxe.git fi echo "entering" $MXEDIR diff --git a/scripts/release-common.sh b/scripts/release-common.sh index 85b719c..a9fb3b5 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -48,17 +48,19 @@ elif [[ $OSTYPE == "linux-gnu" ]]; then else ARCH=32 fi - echo "Detected ARCH: $ARCH" + echo "Detected build-machine ARCH: $ARCH" fi if [ "`echo $* | grep mingw32`" ]; then OS=LINXWIN ARCH=32 + echo Mingw-cross build using ARCH=32 fi if [ "`echo $* | grep mingw64`" ]; then OS=LINXWIN ARCH=64 + echo Mingw-cross build using ARCH=64 fi if [ $OS ]; then diff --git a/src/AboutDialog.html b/src/AboutDialog.html index 6203e83..946f5e7 100644 --- a/src/AboutDialog.html +++ b/src/AboutDialog.html @@ -67,7 +67,7 @@ Please visit this link for a copy of the license: Marius Kintel

@@ -101,6 +101,8 @@ Please visit this link for a copy of the license: iamwilhelm

  • clothbot
  • colah +
  • Peter Uithoven + -- cgit v0.10.1 From 9b5f34a8ecbac1d67ef6a9d974889319bab733d0 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Fri, 17 May 2013 17:58:22 -0500 Subject: fix bad url being pushed to website, bug report per Andrew Plumb diff --git a/scripts/builder.sh b/scripts/builder.sh index 75b80f8..1cee38c 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -119,7 +119,7 @@ update_www_download_links() cd openscad.github.com cd inc echo `pwd` - BASEURL='https://openscad.google.com/files/' + BASEURL='https://openscad.googlecode.com/files/' DATECODE=`date +"%Y.%m.%d"` rm win_snapshot_links.js diff --git a/scripts/publish-macosx.sh b/scripts/publish-macosx.sh index 9d0423d..a3b0090 100755 --- a/scripts/publish-macosx.sh +++ b/scripts/publish-macosx.sh @@ -21,7 +21,7 @@ update_www_download_links() filesize=$(human_filesize $filesize) webdir=../openscad.github.com incfile=inc/mac_snapshot_links.js - BASEURL='https://openscad.google.com/files/' + BASEURL='https://openscad.googlecode.com/files/' DATECODE=`date +"%Y.%m.%d"` if [ -f $webdir/$incfile ]; then -- cgit v0.10.1 From 5e995b9ff41c6b6e6d288356f3387b4fab106c5f Mon Sep 17 00:00:00 2001 From: Don Bright Date: Fri, 17 May 2013 18:10:37 -0500 Subject: windows zipfile was filpped with installfile diff --git a/scripts/builder.sh b/scripts/builder.sh index 1cee38c..6232904 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -69,12 +69,12 @@ upload_win_generic() upload_win32() { - SUMMARY1="Windows x86-32 Snapshot Zipfile" - SUMMARY2="Windows x86-32 Snapshot Installer" + SUMMARY1="Windows x86-32 Snapshot Installer" + SUMMARY2="Windows x86-32 Snapshot Zipfile" DATECODE=`date +"%Y.%m.%d"` BASEDIR=./mingw32/ - WIN32_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-32.zip - WIN32_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-32-Installer.exe + WIN32_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-32-Installer.zip + WIN32_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-32.exe upload_win_generic "$SUMMARY1" $USERNAME $BASEDIR/$WIN32_PACKAGEFILE1 upload_win_generic "$SUMMARY2" $USERNAME $BASEDIR/$WIN32_PACKAGEFILE2 export WIN32_PACKAGEFILE1 -- cgit v0.10.1 From e25fff81af72a31f6118f4840b65193aa0ec1d0a Mon Sep 17 00:00:00 2001 From: Don Bright Date: Fri, 17 May 2013 18:14:10 -0500 Subject: windows .zip flipped with .exe diff --git a/scripts/builder.sh b/scripts/builder.sh index 6232904..876e6d1 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -73,8 +73,8 @@ upload_win32() SUMMARY2="Windows x86-32 Snapshot Zipfile" DATECODE=`date +"%Y.%m.%d"` BASEDIR=./mingw32/ - WIN32_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-32-Installer.zip - WIN32_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-32.exe + WIN32_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-32-Installer.exe + WIN32_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-32.zip upload_win_generic "$SUMMARY1" $USERNAME $BASEDIR/$WIN32_PACKAGEFILE1 upload_win_generic "$SUMMARY2" $USERNAME $BASEDIR/$WIN32_PACKAGEFILE2 export WIN32_PACKAGEFILE1 -- cgit v0.10.1 From 48816160cd87fe067156c5b8622e31ab10754e74 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 18 May 2013 17:49:26 +0200 Subject: fix eigen bugs mingw32/64 diff --git a/eigen.pri b/eigen.pri index 1c9a5ef..7b4d46a 100644 --- a/eigen.pri +++ b/eigen.pri @@ -15,10 +15,6 @@ OPENSCAD_LIBRARIES_DIR = $$(OPENSCAD_LIBRARIES) EIGEN2_DIR = $$(EIGEN2DIR) EIGEN_DIR = $$(EIGENDIR) -CONFIG(mingw-cross-env) { - EIGEN_INCLUDEPATH = mingw-cross-env/include/eigen2 -} - # Optionally specify location of Eigen3 using the # OPENSCAD_LIBRARIES env. variable !isEmpty(OPENSCAD_LIBRARIES_DIR) { @@ -69,16 +65,6 @@ isEmpty(EIGEN_INCLUDEPATH) { EIGEN_INCLUDEPATH = $$replace(EIGEN_CFLAGS,"-I","") } -mingw-cross-env { - exists(mingw-cross-env/../i686-pc-mingw32-pkg-config) { - EIGEN_CFLAGS = $$system("i686-pc-mingw32-pkg-config --cflags eigen3") - } - exists(mingw-cross-env/../x86_64-w64-mingw32-pkg-config) { - EIGEN_CFLAGS = $$system("x86_64-w64-mingw32-pkg-config --cflags eigen3") - } - EIGEN_INCLUDEPATH = $$replace(EIGEN_CFLAGS,"-I","") -} - # disable Eigen SIMD optimizations for platforms where it breaks compilation !macx { !freebsd-g++ { diff --git a/scripts/builder.sh b/scripts/builder.sh index 7cd551e..11b6e02 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -33,6 +33,7 @@ get_source_code() git clone http://github.com/openscad/openscad.git cd openscad git submodule update --init # MCAD + git checkout issue341 } build_win32() diff --git a/scripts/mingw-x-build-dependencies.sh b/scripts/mingw-x-build-dependencies.sh index c3d5179..e9f124b 100755 --- a/scripts/mingw-x-build-dependencies.sh +++ b/scripts/mingw-x-build-dependencies.sh @@ -46,13 +46,13 @@ fi if [ ! -e $MXEDIR ]; then mkdir -p $MXEDIR -fi -cd $MXEDIR/.. -echo "Downloading MXE into " $PWD -if [ "`echo $* | grep 64`" ]; then - git clone -b multi-rebase git://github.com/tonytheodore/mxe.git ./mxe-w64 -else - git clone git://github.com/mxe/mxe.git + cd $MXEDIR/.. + echo "Downloading MXE into " $PWD + if [ "`echo $* | grep 64`" ]; then + git clone -b multi-rebase git://github.com/tonytheodore/mxe.git $MXEDIR + else + git clone git://github.com/mxe/mxe.git $MXEDIR + fi fi echo "entering" $MXEDIR diff --git a/scripts/setenv-mingw-xbuild.sh b/scripts/setenv-mingw-xbuild.sh index 15449ce..d3a014c 100644 --- a/scripts/setenv-mingw-xbuild.sh +++ b/scripts/setenv-mingw-xbuild.sh @@ -57,11 +57,10 @@ fi PATH=$MXEDIR/usr/bin:$PATH PATH=$MXETARGETDIR/qt/bin:$PATH - - - +OPENSCAD_LIBRARIES=$MXETARGETDIR if [ "`echo $* | grep clean`" ]; then + OPENSCAD_LIBRARIES= BASEDIR= MXEDIR= MXETARGETDIR= @@ -75,6 +74,7 @@ else ln -s $MXETARGETDIR $DEPLOYDIR/mingw-cross-env fi +export OPENSCAD_LIBRARIES export BASEDIR export MXEDIR export MXETARGETDIR @@ -82,6 +82,7 @@ export DEPLOYDIR export PATH export MINGWX_SAVED_ORIGINAL_PATH +echo OPENSCAD_LIBRARIES: $OPENSCAD_LIBRARIES echo BASEDIR: $BASEDIR echo MXEDIR: $MXEDIR echo MXETARGETDIR: $MXETARGETDIR -- cgit v0.10.1 From 7d68cb0232d15950275b22836652238625eb9ae2 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 18 May 2013 18:39:48 +0200 Subject: improve mingw build, make rm silent diff --git a/mingw-cross-env.pri b/mingw-cross-env.pri index a447fd8..1ddce88 100644 --- a/mingw-cross-env.pri +++ b/mingw-cross-env.pri @@ -4,15 +4,16 @@ CONFIG(mingw-cross-env) { LIBS += mingw-cross-env/lib/libglut.a LIBS += mingw-cross-env/lib/libopengl32.a LIBS += mingw-cross-env/lib/libGLEW.a - exists( mingw-cross-env/lib/libglaux.a ) { - LIBS += mingw-cross-env/lib/libglaux.a - } +# exists( mingw-cross-env/lib/libglaux.a ) { +# LIBS += mingw-cross-env/lib/libglaux.a +# } LIBS += mingw-cross-env/lib/libglu32.a LIBS += mingw-cross-env/lib/libopencsg.a LIBS += mingw-cross-env/lib/libmpfr.a LIBS += mingw-cross-env/lib/libgmp.a LIBS += mingw-cross-env/lib/libCGAL.a QMAKE_CXXFLAGS += -fpermissive + QMAKE_DEL_FILE = rm -f } diff --git a/scripts/release-common.sh b/scripts/release-common.sh index a9fb3b5..261905d 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -160,7 +160,7 @@ esac case $OS in LINXWIN) cd $DEPLOYDIR - make -s clean ## comment out for test-run + make clean ## comment out for test-run cd $OPENSCADDIR ;; *) -- cgit v0.10.1 From 78303a79fae63bc3f7519184fa10f7e1e9cb5653 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 18 May 2013 18:45:13 +0200 Subject: reduce flood of eigen warnings on mingw build diff --git a/mingw-cross-env.pri b/mingw-cross-env.pri index 1ddce88..f13bfa7 100644 --- a/mingw-cross-env.pri +++ b/mingw-cross-env.pri @@ -14,6 +14,5 @@ CONFIG(mingw-cross-env) { LIBS += mingw-cross-env/lib/libCGAL.a QMAKE_CXXFLAGS += -fpermissive QMAKE_DEL_FILE = rm -f + QMAKE_CXXFLAGS_WARN_ON += -Wunused-local-typedefs #eigen3 } - - -- cgit v0.10.1 From d8bcf47df699ce7104a7cb0572cbf6c34f6a3cd8 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 18 May 2013 18:48:39 +0200 Subject: gcc warning off, eigen3 mingw build diff --git a/mingw-cross-env.pri b/mingw-cross-env.pri index f13bfa7..e696b56 100644 --- a/mingw-cross-env.pri +++ b/mingw-cross-env.pri @@ -14,5 +14,5 @@ CONFIG(mingw-cross-env) { LIBS += mingw-cross-env/lib/libCGAL.a QMAKE_CXXFLAGS += -fpermissive QMAKE_DEL_FILE = rm -f - QMAKE_CXXFLAGS_WARN_ON += -Wunused-local-typedefs #eigen3 + QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedefs #eigen3 } -- cgit v0.10.1 From 127d84a58cf58f394f6786429296bde357803a24 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 18 May 2013 18:55:44 +0200 Subject: url bugfix diff --git a/scripts/builder.sh b/scripts/builder.sh index 11b6e02..6a9fd54 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -159,7 +159,7 @@ update_win_www_download_links() cd openscad.github.com cd inc echo `pwd` - BASEURL='https://openscad.google.com/files/' + BASEURL='https://openscad.googlecode.com/files/' rm win_snapshot_links.js echo "snapinfo['WIN64_SNAPSHOT1_URL'] = '$BASEURL$WIN64_PACKAGEFILE1'" >> win_snapshot_links.js -- cgit v0.10.1 From 874a4840687bc0c3209ffe3bcb7649f549a18e63 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 18 May 2013 18:57:08 +0200 Subject: if .com fails, stop build. also stop using make || make diff --git a/scripts/release-common.sh b/scripts/release-common.sh index 261905d..5c63ccd 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -180,10 +180,9 @@ esac case $OS in LINXWIN) - # make || make enables paralell builds, thanks Tony Theodore # make main openscad.exe cd $DEPLOYDIR - make $TARGET -j$NUMCPU || make $TARGET -j$NUMCPU ## comment 4 test + make $TARGET -j$NUMCPU ## comment 4 test if [ ! -e $TARGET/openscad.exe ]; then echo "cant find $TARGET/openscad.exe. build failed. stopping." exit @@ -191,6 +190,10 @@ case $OS in # make console pipe-able openscad.com - see winconsole.pri for info qmake CONFIG+=winconsole ../openscad.pro make + if [ ! -e $TARGET/openscad.com ]; then + echo "cant find $TARGET/openscad.com. build failed. stopping." + exit + fi cd $OPENSCADDIR ;; -- cgit v0.10.1 From cc94b647f1af763944d104468affb48625ab7f9a Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 18 May 2013 19:01:35 +0200 Subject: credit tony theodore diff --git a/scripts/release-common.sh b/scripts/release-common.sh index 5c63ccd..9e56263 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -12,7 +12,7 @@ # -d Version date (e.g. -d 2010.01.23) # -c Build with commit info # -mingw32 Cross-compile for win32 using MXE -# -mingw64 Cross-compile for win64 using MXE +# -mingw64 Cross-compile for win64 using Tony Theodore's MXE fork # # If no version string or version date is given, todays date will be used (YYYY-MM-DD) # If only verion date is given, it will be used also as version string. diff --git a/src/AboutDialog.html b/src/AboutDialog.html index 946f5e7..2ec691d 100644 --- a/src/AboutDialog.html +++ b/src/AboutDialog.html @@ -107,7 +107,7 @@ OpenSCAD Maintainer: Marius Kintel

    -Mailing list, bug reports, testing, contribs, &c +Mailing list, bug reports, testing, contribs, help, &c

    nop head, Triffid Hunter, Len Trigg, Kliment Yanev, Christian Siefkes, @@ -117,7 +117,7 @@ Brett Sutton, hmnapier, Eero af Heurlin, caliston, 5263, ghost, 42loop, uniqx, Michael Thomson, Michael Ivko, Pierre Doucet, myglc2, Alan Cox, Peter Falke, Michael Ambrus, Gordon Wrigley, Ed Nisley, Stony Smith, Pasca Andrei, David Goodenough, William A Adams, mrrobinson, 1i7, -benhowes, 5263, Craig Trader, Miro Hrončok, ... and many others +benhowes, 5263, Craig Trader, Miro Hrončok, Tony Theodore ... and many others

    Hosting & resources -- cgit v0.10.1 From 2c5b09a0a79609b5cf02f1abc9dca0cb27677f79 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 18 May 2013 19:03:08 +0200 Subject: zip silent diff --git a/scripts/release-common.sh b/scripts/release-common.sh index 9e56263..7d36907 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -142,7 +142,7 @@ case $OS in . ./scripts/setenv-mingw-xbuild.sh $ARCH TARGET=release ZIP="zip" - ZIPARGS="-r" + ZIPARGS="-r -q" ;; esac -- cgit v0.10.1 From 6509f0838269de67e6b84759ef36f0078f6e65f7 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Sat, 18 May 2013 14:37:04 -0500 Subject: allow 'upload only' and 'dryrun' debugging options diff --git a/scripts/builder.sh b/scripts/builder.sh index 6a9fd54..984a651 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -12,12 +12,24 @@ # # todo - detect failure and stop -DRYRUN=1 - init_variables() { STARTPATH=$PWD export STARTPATH + if [ "`echo $* | grep uploadonly`" ]; then + UPLOADONLY=1 + DATECODE=`date +"%Y.%m.%d"` + else + UPLOADONLY= + fi + if [ "`echo $* | grep dry`" ]; then + DRYRUN=1 + else + DRYRUN= + fi + export UPLOADONLY + export DRYRUN + export DATECODE } check_starting_path() @@ -198,15 +210,17 @@ check_ssh_agent() fi } -init_variables +init_variables $* check_ssh_agent check_starting_path read_username_from_user read_password_from_user get_source_code -build_win32 -build_win64 +if [ ! $UPLOADONLY ]; then + build_win32 + build_win64 +fi upload_win32 upload_win64 update_win_www_download_links -- cgit v0.10.1 From ca4fb9238fa50fc11efdc36070bdd38f77148ff5 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Sat, 18 May 2013 15:40:01 -0500 Subject: update readme diff --git a/README.md b/README.md index 5bbe8b6..73eea87 100644 --- a/README.md +++ b/README.md @@ -188,14 +188,14 @@ http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_on_Windows To cross-build, first make sure that you have development tools installed to get GCC. Then after you've cloned this git repository, -start a new clean shell and run the script that sets up the environment +start a new clean bash shell and run the script that sets up the environment variables. - source ./scripts/setenv-mingw-xbuild.sh + source ./scripts/setenv-mingw-xbuild.sh 32 Then run the script to download & compile all the prerequisite libraries above: - ./scripts/mingw-x-build-dependencies.sh + ./scripts/mingw-x-build-dependencies.sh 32 Note that this process can take several hours, as it uses the http://mxe.cc system to cross-build many libraries. After it is @@ -208,7 +208,9 @@ If you wish you can only build the openscad.exe binary: cd mingw32 qmake .. CONFIG+=mingw-cross-env make - + +For a 64-bit Windows cross-build, replace 32 with 64 in the above instructions. + ### Compilation First, run 'qmake' from Qt4 to generate a Makefile. On some systems you need to diff --git a/scripts/builder.sh b/scripts/builder.sh index 984a651..9850bcc 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -45,7 +45,7 @@ get_source_code() git clone http://github.com/openscad/openscad.git cd openscad git submodule update --init # MCAD - git checkout issue341 + #git checkout branch ##debugging } build_win32() @@ -104,8 +104,8 @@ upload_win32() SUMMARY1="Windows x86-32 Snapshot Zipfile" SUMMARY2="Windows x86-32 Snapshot Installer" BASEDIR=./mingw32/ - WIN32_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-32.zip - WIN32_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-32-Installer.exe + WIN32_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-32-Installer.exe + WIN32_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-32.zip upload_win_generic "$SUMMARY1" $USERNAME $BASEDIR/$WIN32_PACKAGEFILE1 upload_win_generic "$SUMMARY2" $USERNAME $BASEDIR/$WIN32_PACKAGEFILE2 export WIN32_PACKAGEFILE1 @@ -123,8 +123,8 @@ upload_win64() SUMMARY1="Windows x86-64 Snapshot Zipfile" SUMMARY2="Windows x86-64 Snapshot Installer" BASEDIR=./mingw64/ - WIN64_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-64.zip - WIN64_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-64-Installer.exe + WIN64_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-64-Installer.exe + WIN64_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-64.zip upload_win_generic "$SUMMARY1" $USERNAME $BASEDIR/$WIN64_PACKAGEFILE1 upload_win_generic "$SUMMARY2" $USERNAME $BASEDIR/$WIN64_PACKAGEFILE2 export WIN64_PACKAGEFILE1 @@ -192,7 +192,7 @@ update_win_www_download_links() PAGER=cat git diff if [ ! $DRYRUN ]; then git commit -a -m 'builder.sh - updated snapshot links' - git push origin + git push origin master else echo dry run, not updating www links fi -- cgit v0.10.1 From 5a647f963a2dbe2344fe64d98ea5bd42f8f3e806 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Sat, 18 May 2013 16:04:59 -0500 Subject: bold a single about box line diff --git a/src/AboutDialog.html b/src/AboutDialog.html index 2ec691d..005f61f 100644 --- a/src/AboutDialog.html +++ b/src/AboutDialog.html @@ -67,7 +67,7 @@ Please visit this link for a copy of the license: Marius Kintel +OpenSCAD Maintainer: Marius Kintel

    -- cgit v0.10.1 From fab07bafdaacf931314673e396111a9670dccc0e Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 21 May 2013 19:21:00 -0400 Subject: Added recursion example. Fixes #346 diff --git a/examples/example024.scad b/examples/example024.scad new file mode 100644 index 0000000..1502ec7 --- /dev/null +++ b/examples/example024.scad @@ -0,0 +1,32 @@ +// Menger Sponge +// By Nathan Hellweg, Emmett Lalish and Marius Kintel May 13, 2013 +// CC-BY-SA license + +// Size of edge of sponge +D=100; +// Fractal depth (number of iterations) +n=3; + +module menger() { + difference() { + cube(D, center=true); + for (v=[[0,0,0], [0,0,90], [0,90,0]]) + rotate(v) menger_negative(side=D, maxside=D, level=n); + } +} + +module menger_negative(side=1, maxside=1, level=1) { + l=side/3; + cube([maxside*1.1, l, l], center=true); + if (level > 1) { + for (i=[-1:1], j=[-1:1]) + if (i || j) + translate([0, i*l, j*l]) + menger_negative(side=l, maxside=maxside, level=level-1); + } +} + +difference() { + rotate([45, atan(1/sqrt(2)), 0]) menger(); + translate([0,0,-D]) cube(2*D, center=true); +} -- cgit v0.10.1 From 71ab237aada8db602045063f0f1c6082ef06972a Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 21 May 2013 21:26:51 -0400 Subject: Added tests for linear extrude with scale. Should mostly fix #273 diff --git a/testdata/scad/features/linear_extrude-scale-tests.scad b/testdata/scad/features/linear_extrude-scale-tests.scad deleted file mode 100644 index 9a82c9d..0000000 --- a/testdata/scad/features/linear_extrude-scale-tests.scad +++ /dev/null @@ -1,17 +0,0 @@ -difference() { - linear_extrude(height=40, scale=[0, 0]) { - square(10, center=true); - translate([10,0]) circle(10); - } - translate([0,0,35]) sphere(10); -} - -/* -Test case ideas: -o off-center starting point -o Concave polygon -o Disjoint polygons -o multi-rotation twist -o zero scales, zero scales in only one axis (for the above cases) -o boolean operations on scaled extrusion (including zero scale) -*/ diff --git a/testdata/scad/features/linear_extrude-scale-zero-tests.scad b/testdata/scad/features/linear_extrude-scale-zero-tests.scad new file mode 100644 index 0000000..8a85203 --- /dev/null +++ b/testdata/scad/features/linear_extrude-scale-zero-tests.scad @@ -0,0 +1,56 @@ +// test cases for linear extrude with scale +// by TakeItAndRun 2013 + +// syntax: linear_extrude(height=a, slices=b, twist=c, scale=[x,y]) + +a=3; +b=20; +c=0; +x=1; +y=1; + +module linear_extrudes_of_different_shapes(a=a,b=b,c=c,x=x,y=y) { + translate(00*[4,0,0]) + // linear_extrude of shape with hole + linear_extrude(height=a, slices=b, twist=c, scale=[x,y]) + difference() { + square(2,true); square(1,true); + } + + translate(01*[4,0,0]) + // linear_extrude of disjoint polygons shapes + linear_extrude(height=a, slices=b, twist=c, scale=[x,y]) { + translate([1,0,0]) square(1,true); + translate([-1,0,0]) square(1,true); + } + + translate(02*[4,0,0]) + // linear_extrude with a coplanar face + linear_extrude(height=a, slices=b, twist=c, scale=[x,y]) { + translate([.5,0,0])square(); + translate([-.5,0,0])square(); + } + + translate(03*[4,0,0]) + // linear_extrude with internal hole and one coplanar edge + linear_extrude(height=a, slices=b, twist=c, scale=[x,y]) + difference() { + square(2,true); + translate([-0.5,0,0]) square(1,true); + } +} + + +// Test varying parameters +translate(00*[0,3,0]) +linear_extrudes_of_different_shapes(c=0,x=0,y=y); +translate(01*[0,3,0]) +linear_extrudes_of_different_shapes(c=0,x=x,y=0); +translate(02*[0,3,0]) +linear_extrudes_of_different_shapes(c=0,x=0,y=0); +translate(03*[0,3,0]) +linear_extrudes_of_different_shapes(c=180,x=0,y=y); +translate(04*[0,3,0]) +linear_extrudes_of_different_shapes(c=180,x=x,y=0); +translate(05*[0,3,0]) +linear_extrudes_of_different_shapes(c=180,x=0,y=0); diff --git a/testdata/scad/features/linear_extrude-tests.scad b/testdata/scad/features/linear_extrude-tests.scad index 67d892f..528eea2 100644 --- a/testdata/scad/features/linear_extrude-tests.scad +++ b/testdata/scad/features/linear_extrude-tests.scad @@ -12,4 +12,13 @@ translate([31.5,2.5,0]) linear_extrude(height=10, twist=-45) polygon(points = [[ translate([0,20,0]) linear_extrude(height=20, twist=45, slices=2) square([10,10]); translate([19,20,0]) linear_extrude(height=20, twist=45, slices=10) square([10,10]); -translate([-15,0,0]) linear_extrude(5) square([10,10]); +translate([0,-15,0]) linear_extrude(5) square([10,10]); + +// scale given as a scalar +translate([-25,-10,0]) linear_extrude(height=10, scale=2) square(5, center=true); +// scale given as a 3-dim vector +translate([-15,20,0]) linear_extrude(height=20, scale=[4,5,6]) square(10); +// scale is negative +translate([-10,5,0]) linear_extrude(height=15, scale=-2) square(10, center=true); +// scale given as undefined +translate([-15,-15,0]) linear_extrude(height=10, scale=var_undef) square(10); diff --git a/tests/regression/cgalpngtest/linear_extrude-scale-zero-tests-expected.png b/tests/regression/cgalpngtest/linear_extrude-scale-zero-tests-expected.png new file mode 100644 index 0000000..3b1c934 Binary files /dev/null and b/tests/regression/cgalpngtest/linear_extrude-scale-zero-tests-expected.png differ diff --git a/tests/regression/cgalpngtest/linear_extrude-tests-expected.png b/tests/regression/cgalpngtest/linear_extrude-tests-expected.png index 7d3ea2c..c85142e 100644 Binary files a/tests/regression/cgalpngtest/linear_extrude-tests-expected.png and b/tests/regression/cgalpngtest/linear_extrude-tests-expected.png differ diff --git a/tests/regression/dumptest/linear_extrude-scale-zero-tests-expected.txt b/tests/regression/dumptest/linear_extrude-scale-zero-tests-expected.txt new file mode 100644 index 0000000..950c724 --- /dev/null +++ b/tests/regression/dumptest/linear_extrude-scale-zero-tests-expected.txt @@ -0,0 +1,253 @@ + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [0, 1], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [0, 1], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + multmatrix([[1, 0, 0, -1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [0, 1], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [0, 1], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [1, 0], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [1, 0], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + multmatrix([[1, 0, 0, -1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [1, 0], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [1, 0], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + multmatrix([[1, 0, 0, -1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 0, slices = 20, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 9], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [0, 1], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [0, 1], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + multmatrix([[1, 0, 0, -1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [0, 1], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [0, 1], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [1, 0], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [1, 0], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + multmatrix([[1, 0, 0, -1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [1, 0], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [1, 0], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 15], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + multmatrix([[1, 0, 0, -1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + multmatrix([[1, 0, 0, 0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 3, center = false, convexity = 1, twist = 180, slices = 20, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + difference() { + square(size = [2, 2], center = true); + multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + } + } + } + } + } + diff --git a/tests/regression/dumptest/linear_extrude-tests-expected.txt b/tests/regression/dumptest/linear_extrude-tests-expected.txt index c031ed8..c867388 100644 --- a/tests/regression/dumptest/linear_extrude-tests-expected.txt +++ b/tests/regression/dumptest/linear_extrude-tests-expected.txt @@ -29,9 +29,29 @@ square(size = [10, 10], center = false); } } - multmatrix([[1, 0, 0, -15], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, -15], [0, 0, 1, 0], [0, 0, 0, 1]]) { linear_extrude(height = 5, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { square(size = [10, 10], center = false); } } + multmatrix([[1, 0, 0, -25], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 10, center = false, convexity = 1, scale = [2, 2], $fn = 0, $fa = 12, $fs = 2) { + square(size = [5, 5], center = true); + } + } + multmatrix([[1, 0, 0, -15], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 20, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { + square(size = [10, 10], center = false); + } + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 15, center = false, convexity = 1, scale = [0, 0], $fn = 0, $fa = 12, $fs = 2) { + square(size = [10, 10], center = true); + } + } + multmatrix([[1, 0, 0, -15], [0, 1, 0, -15], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 10, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) { + square(size = [10, 10], center = false); + } + } diff --git a/tests/regression/opencsgtest/linear_extrude-scale-zero-tests-expected.png b/tests/regression/opencsgtest/linear_extrude-scale-zero-tests-expected.png new file mode 100644 index 0000000..22e94ad Binary files /dev/null and b/tests/regression/opencsgtest/linear_extrude-scale-zero-tests-expected.png differ diff --git a/tests/regression/opencsgtest/linear_extrude-tests-expected.png b/tests/regression/opencsgtest/linear_extrude-tests-expected.png index b929d09..cbbdc11 100644 Binary files a/tests/regression/opencsgtest/linear_extrude-tests-expected.png and b/tests/regression/opencsgtest/linear_extrude-tests-expected.png differ diff --git a/tests/regression/throwntogethertest/linear_extrude-scale-zero-tests-expected.png b/tests/regression/throwntogethertest/linear_extrude-scale-zero-tests-expected.png new file mode 100644 index 0000000..22e94ad Binary files /dev/null and b/tests/regression/throwntogethertest/linear_extrude-scale-zero-tests-expected.png differ diff --git a/tests/regression/throwntogethertest/linear_extrude-tests-expected.png b/tests/regression/throwntogethertest/linear_extrude-tests-expected.png index fddeeb8..cbbdc11 100644 Binary files a/tests/regression/throwntogethertest/linear_extrude-tests-expected.png and b/tests/regression/throwntogethertest/linear_extrude-tests-expected.png differ -- cgit v0.10.1