Thanks lucid. It'll take me a while to get up and going anyway, I just didn't want to start with the wrong assumptions. So the SCML format is basically set now, and complete?
@Grimfang
I've just downloaded the code project so I can have a look at it in Visual Studio 2010. Out of the box, I'm getting compile errors. I assume others have gotten Visual Studio to work, so not sure what I've missed. I'm just using the SCMLpp and the XML files and trying to put them in a wrapper project of my own, to just get it compiled. It's producing the following errors :-
1> SCMLpp.cpp 1>..\..\Sources\SCMLpp.cpp(26): error C2039: 'find' : is not a member of 'std' 1>..\..\Sources\SCMLpp.cpp(26): error C2228: left of '.base' must have class/struct/union 1> type is ''unknown-type'' 1>..\..\Sources\SCMLpp.cpp(26): error C3861: 'find': identifier not found 1>..\..\Sources\SCMLpp.cpp(2370): error C3861: 'c99_snprintf': identifier not found 1>..\..\Sources\SCMLpp.cpp(2511): error C2065: 'M_PI' : undeclared identifier 1>..\..\Sources\SCMLpp.cpp(2512): error C2065: 'M_PI' : undeclared identifier 1> XML_Helpers.cpp 1>..\..\Sources\XML_Helpers.cpp(15): error C3861: 'c99_vsnprintf': identifier not found 1>..\..\Sources\XML_Helpers.cpp(54): warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) 1>..\..\Sources\XML_Helpers.cpp(64): warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data 1> Generating Code... ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I see there are some tests for Visual Studio in the code, but that's where the first one about std::find is coming up, so I may have my compiler directives wrong. I'll work through the errors and see if I can resolve them, but is there something obvious missing that should maybe be documented for VS users?
Thanks. Russell.
*EDIT*
I've made the following changes to correct the errors
1. Replaced my line 26
source.erase(std::find(source.rbegin(), source.rend(), '/').base(), source.end());
with
source.erase(source.rfind('/'), source.length());
2. Added the following declaration to XML_Helpers.h
int c99_snprintf(char* str, size_t size, const char* format, ...);
3. Added the following include to SCMLpp.cpp
#include
4. Swapped the declaration of the print helpers in XML_Helpers.cpp as follows
// Visual Studio does not support snprintf properly. // This is from Valentin Milea on Stack Overflow. http://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010/8712996#8712996 #ifdef _MSC_VER #define snprintf c99_snprintf int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap) { int count = -1; if (size != 0) count = _vsnprintf_s(str, size, _TRUNCATE, format, ap); if (count == -1) count = _vscprintf(format, ap); return count; } int c99_snprintf(char* str, size_t size, const char* format, ...) { int count; va_list ap; va_start(ap, format); count = c99_vsnprintf(str, size, format, ap); va_end(ap); return count; } #else #include "libgen.h" #endif // _MSC_VER
5. And just because I don't like warnings either, I did an explicit conversion for the 2 remaining double to float warnings on setting s and c in SCMLpp.cpp
// This is for rotating untranslated points and offsetting them to a new origin. static void rotate_point(float& x, float& y, float angle, float origin_x, float origin_y, bool flipped) { if(flipped) angle = -angle; float s = (float)sin(angle*M_PI/180); float c = (float)cos(angle*M_PI/180); float xnew = (x * c) - (y * s); float ynew = (x * s) + (y * c); xnew += origin_x; ynew += origin_y; x = xnew; y = ynew; }
After those changes, I had a clean compile.