Merge branch 'master' into libtess2

master
Marius Kintel 2015-01-13 13:14:51 -05:00
commit 4b60231d3b
12 changed files with 617 additions and 272 deletions

File diff suppressed because it is too large Load Diff

View File

@ -514,6 +514,7 @@ unix:!macx {
SOURCES += src/PlatformUtils-posix.cc
}
win* {
HEADERS += src/findversion.h
SOURCES += src/PlatformUtils-win.cc
}

View File

@ -161,7 +161,7 @@ build_ragel()
cd "$BASEDIR"/src
rm -rf "ragel-$version"
if [ ! -f "ragel-$version.tar.gz" ]; then
curl --insecure -LO "http://www.complang.org/ragel/ragel-$version.tar.gz"
curl --insecure -LO "http://www.colm.net/files/ragel/ragel-$version.tar.gz"
fi
tar xzf "ragel-$version.tar.gz"
cd "ragel-$version"

View File

@ -813,7 +813,7 @@ build_glib2 2.38.2
build_freetype 2.5.0.1 --without-png
build_libxml2 2.9.1
build_fontconfig 2.11.0 --with-add-fonts=/usr/X11R6/lib/X11/fonts,/usr/local/share/fonts
build_ragel 6.8
build_ragel 6.9
build_harfbuzz 0.9.23 --with-glib=yes
echo "OpenSCAD dependencies built and installed to " $BASEDIR

View File

@ -1,5 +1,6 @@
#include "PlatformUtils.h"
#include "printutils.h"
#include "findversion.h"
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
@ -126,7 +127,8 @@ std::string PlatformUtils::sysinfo()
OSVERSIONINFOEX osinfo;
osinfo.dwOSVersionInfoSize = sizeof(osinfo);
if (GetVersionEx((OSVERSIONINFO*)&osinfo) == 0) {
if (GetVersionExEx(&osinfo) == 0) {
result += "Unknown Windows";
} else {
unsigned int version = osinfo.dwMajorVersion * 1000 + osinfo.dwMinorVersion;
@ -154,9 +156,25 @@ std::string PlatformUtils::sysinfo()
// For applications that have been manifested for Windows 8.1.
result += (osinfo.wProductType == VER_NT_WORKSTATION ? "Windows 8.1" : "Windows Server 2012 R2");
break;
default:
result += "Unknown Windows";
break;
}
boost::format fmt(" (v%d.%d)");
fmt % osinfo.dwMajorVersion % osinfo.dwMinorVersion;
if (osinfo.wServicePackMajor > 0) {
boost::format fmtServicePack;
if (osinfo.wServicePackMinor == 0) {
fmtServicePack = boost::format(" SP%d");
fmtServicePack % osinfo.wServicePackMajor;
} else {
fmtServicePack = boost::format(" SP%d.%d");
fmtServicePack % osinfo.wServicePackMajor % osinfo.wServicePackMinor;
}
result += fmtServicePack.str();
}
boost::format fmt(" (v%d.%d.%d.%d)");
fmt % osinfo.dwMajorVersion % osinfo.dwMinorVersion % osinfo.wServicePackMajor % osinfo.wServicePackMinor;
result += fmt.str();
} else {
boost::format fmt("Unknown Windows (dwPlatformId = %d, dwMajorVersion = %d, dwMinorVersion = %d");

120
src/findversion.h Normal file
View File

@ -0,0 +1,120 @@
/*
* Find Windows version using bisection method and VerifyVersionInfo.
*
* Author: M1xA, www.m1xa.com
* Date: 2013.07.07
* Licence: MIT
* Version: 1.0
*
* API:
*
* BOOL GetVersionExEx(OSVERSIONINFOEX * osVer);
* Returns: 0 if fails.
*
* Supported OS: Windows 2000 .. Windows 8.1.
*/
#ifndef __FIND_VERSION__
#define __FIND_VERSION__
#include <windows.h>
#define FV_EQUAL 0
#define FV_LESS -1
#define FV_GREAT 1
#define FV_MIN_VALUE 0
#define FV_MINOR_VERSION_MAX_VALUE 16
int testValue(OSVERSIONINFOEX * value, DWORD verPart, DWORDLONG eq, DWORDLONG gt)
{
if (VerifyVersionInfo(value, verPart, eq) == FALSE)
{
if (VerifyVersionInfo(value, verPart, gt) == TRUE)
return FV_GREAT;
return FV_LESS;
}
else
return FV_EQUAL;
}
DWORDLONG gtFor(DWORD target)
{
return VerSetConditionMask(0, target, VER_GREATER);
}
DWORDLONG eqFor(DWORD target)
{
return VerSetConditionMask(0, target, VER_EQUAL);
}
#define findPartTemplate(T)\
BOOL findPart##T(T * part, DWORD partType, OSVERSIONINFOEX * ret, T a, T b) \
{ \
int funx = FV_EQUAL; \
\
DWORDLONG const eq = eqFor(partType); \
DWORDLONG const gt = gtFor(partType); \
\
T * p = part; \
\
*p = (a + b) / 2; \
\
while ((funx = testValue(ret, partType, eq, gt)) != FV_EQUAL) \
{ \
switch (funx) \
{ \
case FV_GREAT: a = *p; break; \
case FV_LESS: b = *p; break; \
} \
\
*p = (a + b) / 2; \
\
if (*p == a) \
{ \
if (testValue(ret, partType, eq, gt) == FV_EQUAL) \
return TRUE; \
\
*p = b; \
\
if (testValue(ret, partType, eq, gt) == FV_EQUAL) \
return TRUE; \
\
a = 0; \
b = 0; \
*p = 0; \
} \
\
if (a == b) \
{ \
*p = 0; \
return FALSE; \
} \
} \
\
return TRUE; \
}
findPartTemplate(DWORD)
findPartTemplate(WORD)
findPartTemplate(BYTE)
BOOL GetVersionExEx(OSVERSIONINFOEX * osVer)
{
BOOL ret = TRUE;
ZeroMemory(osVer, sizeof(OSVERSIONINFOEX));
osVer->dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
ret &= findPartDWORD(&osVer->dwPlatformId, VER_PLATFORMID, osVer, FV_MIN_VALUE, MAXDWORD);
ret &= findPartDWORD(&osVer->dwMajorVersion, VER_MAJORVERSION, osVer, FV_MIN_VALUE, MAXDWORD);
ret &= findPartDWORD(&osVer->dwMinorVersion, VER_MINORVERSION, osVer, FV_MIN_VALUE, FV_MINOR_VERSION_MAX_VALUE);
ret &= findPartDWORD(&osVer->dwBuildNumber, VER_BUILDNUMBER, osVer, FV_MIN_VALUE, MAXDWORD);
ret &= findPartWORD(&osVer->wServicePackMajor, VER_SERVICEPACKMAJOR, osVer, FV_MIN_VALUE, MAXWORD);
ret &= findPartWORD(&osVer->wServicePackMinor, VER_SERVICEPACKMINOR, osVer, FV_MIN_VALUE, MAXWORD);
ret &= findPartWORD(&osVer->wSuiteMask, VER_SUITENAME, osVer, FV_MIN_VALUE, MAXWORD);
ret &= findPartBYTE(&osVer->wProductType, VER_PRODUCT_TYPE, osVer, FV_MIN_VALUE, MAXBYTE);
return ret;
}
#endif

View File

@ -712,7 +712,7 @@ ValuePtr builtin_lookup(const Context *, const EvalContext *evalctx)
*/
static Value::VectorType search(const std::string &find, const std::string &table,
unsigned int num_returns_per_match, unsigned int index_col_num)
unsigned int num_returns_per_match)
{
Value::VectorType returnvec;
//Unicode glyph count for the length
@ -761,7 +761,12 @@ static Value::VectorType search(const std::string &find, const Value::VectorType
Value::VectorType resultvec;
const gchar *ptr_ft = g_utf8_offset_to_pointer(find.c_str(), i);
for (size_t j = 0; j < searchTableSize; j++) {
const gchar *ptr_st = g_utf8_offset_to_pointer(table[j].toVector()[index_col_num].toString().c_str(), 0);
Value::VectorType entryVec = table[j].toVector();
if (entryVec.size() <= index_col_num) {
PRINTB("WARNING: Invalid entry in search vector at index %d, required number of values in the entry: %d. Invalid entry: %s", j % (index_col_num + 1) % table[j]);
return Value::VectorType();
}
const gchar *ptr_st = g_utf8_offset_to_pointer(entryVec[index_col_num].toString().c_str(), 0);
if (ptr_ft && ptr_st && (g_utf8_get_char(ptr_ft) == g_utf8_get_char(ptr_st)) ) {
matchCount++;
if (num_returns_per_match == 1) {
@ -814,7 +819,7 @@ ValuePtr builtin_search(const Context *, const EvalContext *evalctx)
}
} else if (findThis->type() == Value::STRING) {
if (searchTable->type() == Value::STRING) {
returnvec = search(findThis->toString(), searchTable->toString(), num_returns_per_match, index_col_num);
returnvec = search(findThis->toString(), searchTable->toString(), num_returns_per_match);
}
else {
returnvec = search(findThis->toString(), searchTable->toVector(), num_returns_per_match, index_col_num);

8
testdata/scad/bugs/issue1105d.scad vendored Normal file
View File

@ -0,0 +1,8 @@
difference() {
rotate_extrude(convexity=2, $fn=8)
translate([5,0,0]) difference() {
circle(r=2);
circle(r=1);
}
translate([-5,-5,5]) cube(10, center=true);
}

View File

@ -1228,7 +1228,8 @@ list(APPEND BUGS_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue584.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue945d.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue1105.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue1105b.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue1105c.scad)
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue1105c.scad
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue1105d.scad)
list(APPEND EXPORT3D_TEST_FILES ${BUGS_FILES})
list(REMOVE_ITEM EXPORT3D_TEST_FILES
${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/issue899.scad

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB