From 7c3bc633e48189aa56d2bb76e8b1e178478a2c02 Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 11 May 2015 19:40:25 +0000 Subject: [PATCH] .autotest git-svn-id: svn://ultimatepp.org/upp/trunk@8432 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- autotest/CppBaseTest/CppBaseTest.cpp | 42 ------ autotest/CppBaseTest/CppBaseTest.upp | 12 -- autotest/CppBaseTest/Test.r | 88 ------------ autotest/CppBaseTest/Test.tc | 201 --------------------------- autotest/CppBaseTest/init | 5 - 5 files changed, 348 deletions(-) delete mode 100644 autotest/CppBaseTest/CppBaseTest.cpp delete mode 100644 autotest/CppBaseTest/CppBaseTest.upp delete mode 100644 autotest/CppBaseTest/Test.r delete mode 100644 autotest/CppBaseTest/Test.tc delete mode 100644 autotest/CppBaseTest/init diff --git a/autotest/CppBaseTest/CppBaseTest.cpp b/autotest/CppBaseTest/CppBaseTest.cpp deleted file mode 100644 index 50eaaa512..000000000 --- a/autotest/CppBaseTest/CppBaseTest.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include - -using namespace Upp; - -StringStream ss; - -void Error(int line, const String& error) -{ - ss << "ERROR at " << line << ": " << error << "\n"; -} - - -CONSOLE_APP_MAIN -{ - FindFile ff(GetDataFile("*.tc")); - while(ff) { - FileIn in(ff.GetPath()); - ss.Create(); - CppBase base; - Parse(in, Vector(), base, "test.cpp", callback(Error)); - Qualify(base); - for(int i = 0; i < base.GetCount(); i++) { - ss << "======== " << Nvl(base.GetKey(i), "GLOBALS") << "\n"; - const Array& am = base[i]; - for(int j = 0; j < am.GetCount(); j++) { - const CppItem& m = am[j]; - m.Dump(ss); - } - } - String result = ss.GetResult(); - LOG("****** FILE: " << ff.GetName()); - VppLog() << result; - LOG("******\n\n"); - String h = LoadFile(ForceExt(ff.GetPath(), ".r")); - result.Replace("\r", ""); - h.Replace("\r", ""); - if(h.GetCount()) - ASSERT(h == result); - ff.Next(); - } -} diff --git a/autotest/CppBaseTest/CppBaseTest.upp b/autotest/CppBaseTest/CppBaseTest.upp deleted file mode 100644 index 194312769..000000000 --- a/autotest/CppBaseTest/CppBaseTest.upp +++ /dev/null @@ -1,12 +0,0 @@ -uses - Core, - CppBase; - -file - CppBaseTest.cpp, - Test.tc highlight cpp, - Test.r; - -mainconfig - "" = ""; - diff --git a/autotest/CppBaseTest/Test.r b/autotest/CppBaseTest/Test.r deleted file mode 100644 index 5d568e8db..000000000 --- a/autotest/CppBaseTest/Test.r +++ /dev/null @@ -1,88 +0,0 @@ -ERROR at 63: Name expected -======== GLOBALS -? VARIABLE PUBLIC FILE_CPP lvalue 3 - natural: NAMESPACE_UPP - type: NAMESPACE_UPP - qtype: NAMESPACE_UPP -? VARIABLE PUBLIC FILE_CPP lvalue 63 - natural: void -? VARIABLE PUBLIC FILE_CPP lvalue 201 - natural: END_UPP_NAMESPACE - type: END_UPP_NAMESPACE - qtype: END_UPP_NAMESPACE -Foo(int,const String&) FUNCTION PUBLIC FILE_CPP decla lvalue 65 - item: Foo(int,const String&) - name: Foo - uname: FOO - natural: void Foo(int x, const String& y) - param: int x;const String& y - pname: x;y - ptype: ;String - qptype: ;String -Foo(int,const String&) FUNCTION PUBLIC FILE_CPP decla lvalue impl 67 - item: Foo(int,const String&) - name: Foo - uname: FOO - natural: void Foo(int x, const String& y) - param: int x;const String& y - pname: x;y - ptype: ;String - qptype: ;String -GetCppFile(int) FUNCTION PUBLIC FILE_CPP decla lvalue impl 21 - item: GetCppFile(int) - name: GetCppFile - uname: GETCPPFILE - natural: const String& GetCppFile(int i) - type: String - qtype: String - param: int i - pname: i -GetCppFileIndex(const String&) FUNCTION PUBLIC FILE_CPP decla lvalue impl 13 - item: GetCppFileIndex(const String&) - name: GetCppFileIndex - uname: GETCPPFILEINDEX - natural: int GetCppFileIndex(const String& path) - param: const String& path - pname: path - ptype: String - qptype: String -PreProcess(Stream&) FUNCTION PUBLIC FILE_CPP decla lvalue impl 69 - item: PreProcess(Stream&) - name: PreProcess - uname: PREPROCESS - natural: SrcFile PreProcess(Stream& in) - type: SrcFile - qtype: SrcFile - param: Stream& in - pname: in - ptype: Stream - qptype: Stream -SLPos(SrcFile&) FUNCTION PUBLIC FILE_CPP decla lvalue impl 51 - item: SLPos(SrcFile&) - name: SLPos - uname: SLPOS - natural: void SLPos(SrcFile& res) - param: SrcFile& res - pname: res - ptype: SrcFile - qptype: SrcFile -cpp_file VARIABLE PUBLIC FILE_CPP lvalue 11 - item: cpp_file - name: cpp_file - uname: CPP_FILE - natural: static Index cpp_file - type: Index - qtype: Index -cpp_file_mutex VARIABLE PUBLIC FILE_CPP lvalue 10 - item: cpp_file_mutex - name: cpp_file_mutex - uname: CPP_FILE_MUTEX - natural: static StaticMutex cpp_file_mutex - type: StaticMutex - qtype: StaticMutex -======== SrcFile -SrcFile() CONSTRUCTOR PUBLIC FILE_CPP decla lvalue impl 56 - item: SrcFile() - name: SrcFile - uname: SRCFILE - natural: SrcFile() diff --git a/autotest/CppBaseTest/Test.tc b/autotest/CppBaseTest/Test.tc deleted file mode 100644 index 8059043a1..000000000 --- a/autotest/CppBaseTest/Test.tc +++ /dev/null @@ -1,201 +0,0 @@ -#include "CppBase.h" - -NAMESPACE_UPP - -#ifdef _MSC_VER -#pragma inline_depth(255) -#pragma optimize("t", on) -#endif - -static StaticMutex cpp_file_mutex; -static Index cpp_file; - -int GetCppFileIndex(const String& path) -{ - INTERLOCKED_(cpp_file_mutex) { - return cpp_file.FindAdd(path); - } - return -1; -} - -const String& GetCppFile(int i) -{ - INTERLOCKED_(cpp_file_mutex) { - return cpp_file[i]; - } - static String x; - return x; -} -/* -void CppPos::Serialize(Stream& s) -{ - s % impl % line; - String fn = GetCppFile(file); - s % fn; - file = GetCppFileIndex(fn); -} - -String SSpaces(const char *txt) -{ - StringBuffer r; - while(*txt) - if(*txt == ' ') { - while((byte)*txt <= ' ' && *txt) txt++; - r.Cat(' '); - } - else - r.Cat(*txt++); - return r; -} -*/ -void SLPos(SrcFile& res) -{ - res.linepos.Add(res.text.GetLength()); -} - -SrcFile::SrcFile() : - preprocessorLinesRemoved(0), - blankLinesRemoved(0), - commentLinesRemoved(0) -{ -} - -void 3BUG(); - -void Foo(int x, const String& y); - -void Foo(int x, const String& y) {} - -SrcFile PreProcess(Stream& in) -{ - SrcFile res; - bool include = true; - while(!in.IsEof()) { - String ln = in.GetLine(); - SLPos(res); - while(*ln.Last() == '\\') { - ln.Trim(ln.GetLength() - 1); - ln.Cat(in.GetLine()); - SLPos(res); - } - const char *rm = ln; - if(IsAlNum(*rm)) { - const char *s = ln.Last(); - while(s > rm && *s == ' ') s--; - if(*s != ':') - res.text << '\2'; - } - while(*rm == ' ' || *rm == '\t') rm++; - if(*rm == '\0') - res.blankLinesRemoved++; - else - if(*rm == '#') - { - if(rm[1] == 'd' && rm[2] == 'e' && rm[3] == 'f' && - rm[4] == 'i' && rm[5] == 'n' && rm[6] == 'e' && !iscid(rm[7])) { - const char *s = rm + 8; - while(*s == ' ') s++; - String macro; - while(iscid(*s)) - macro.Cat(*s++); - if(*s == '(') { - while(*s != ')' && *s) - macro.Cat(*s++); - macro << ')'; - } -// res.text << '#' << AsCString(SSpaces(macro)); - if(include) - res.text << '#' << AsCString(macro); - } - res.preprocessorLinesRemoved++; - } - else { - bool lineContainsComment = false; - bool lineContainsNonComment = false; - String cmd; - while(*rm) { - if(*rm == '\"') { - lineContainsNonComment = true; - res.text << '\"'; - rm++; - while((byte)*rm && *rm != '\r' && *rm != '\n') { - if(*rm == '\"') { - res.text << '\"'; - rm++; - break; - } - if(*rm == '\\' && rm[1]) { - if(include) - res.text.Cat(*rm); - rm++; - } - if(include) - res.text.Cat(*rm); - rm++; - } - } - else - if(*rm == '\\' && rm[1]) { - lineContainsNonComment = true; - if(include) { - res.text.Cat(*rm++); - res.text.Cat(*rm++); - } - else - rm += 2; - } - else - if(rm[0] == '/' && rm[1] == '/') { - cmd = rm + 2; - if(!lineContainsNonComment) - res.commentLinesRemoved++; - break; - } - else - if(rm[0] == '/' && rm[1] == '*') { - lineContainsComment = true; - rm += 2; - for(;;) { - if(*rm == '\0') { - if(!lineContainsNonComment) - res.commentLinesRemoved++; - if(in.IsEof()) break; - SLPos(res); - ln = in.GetLine(); - rm = ~ln; - lineContainsNonComment = false; - } - if(rm[0] == '*' && rm[1] == '/') { - rm += 2; - break; - } - rm++; - } - if(include) - res.text.Cat(' '); - } - else { - lineContainsNonComment = true; - if(include) - res.text.Cat(*rm); - rm++; - } - } - if(include) - res.text << ' '; - if(cmd[0] == '$') { - if(cmd[1] == '-') include = false; - if(cmd[1] == '+') include = true; - if(cmd[1]) { - res.text.Cat(~cmd + 2); - res.text.Cat(' '); - } - } - if(lineContainsComment && !lineContainsNonComment) - res.commentLinesRemoved++; - } - } - return pick(res); -} - -END_UPP_NAMESPACE diff --git a/autotest/CppBaseTest/init b/autotest/CppBaseTest/init deleted file mode 100644 index cb3b31c56..000000000 --- a/autotest/CppBaseTest/init +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef _CppBaseTest_icpp_init_stub -#define _CppBaseTest_icpp_init_stub -#include "Core/init" -#include "CppBase/init" -#endif