X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fsourcemap.cpp;fp=source%2Fglsl%2Fsourcemap.cpp;h=e74f1b67408367ab2ff2a3a28c6381b6aa54656e;hb=9d798ac368bfd236a7632a3a15e51bd1112ea63d;hp=0000000000000000000000000000000000000000;hpb=af00eefb3f7da48ec4038357035980c31cbcb685;p=libs%2Fgl.git diff --git a/source/glsl/sourcemap.cpp b/source/glsl/sourcemap.cpp new file mode 100644 index 00000000..e74f1b67 --- /dev/null +++ b/source/glsl/sourcemap.cpp @@ -0,0 +1,84 @@ +#include +#include +#include +#include "sourcemap.h" + +using namespace std; + +namespace Msp { +namespace GL { +namespace SL { + +SourceMap::SourceMap(): + base_index(0) +{ } + +void SourceMap::set_name(unsigned i, const std::string &n) +{ + if(source_names.empty()) + base_index = i; + else if(i lines = split(errors, '\n'); + string translated; + for(vector::const_iterator i=lines.begin(); i!=lines.end(); ++i) + { + RegMatch m = r_message.match(*i); + if(m) + { + unsigned index = 0; + unsigned line = 0; + if(m[2]) + { + index = lexical_cast(m[2].str); + line = lexical_cast(m[3].str); + } + else if(m[4]) + { + index = lexical_cast(m[4].str); + line = lexical_cast(m[5].str); + } + const char *src = ""; + if(index