reorganizing repo

git-svn-id: svn://ultimatepp.org/upp/trunk@9206 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2015-11-22 11:23:48 +00:00
parent 7d17505cfe
commit e3e8d627f5
3840 changed files with 0 additions and 1161578 deletions

View file

@ -1,90 +0,0 @@
#ifndef _cpp_cpp_h_
#define _cpp_cpp_h_
#include <Core/Core.h>
#include <CppBase/CppBase.h>
using namespace Upp;
<<<<<<< .mine
void RemoveComments(String& l, bool& incomment);
const Index<String>& CppKeywordsIndex();
struct CppMacro : Moveable<CppMacro>, DeepCopyOption<CppMacro> {
String param;
String body;
String Define(const char *s);
String Expand(const Vector<String>& p) const;
String ToString() const;
};
enum PPItemType {
PP_DEFINE,
PP_INCLUDE,
PP_USING,
PP_NAMESPACE,
PP_NAMESPACE_END
};
struct PPItem : Moveable<PPItem> {
int type;
String id;
CppMacro macro;
};
struct PPFile { // contains "macro extract" of file, only info about macros defined and namespaces
FileTime filetime;
Array<PPItem> item;
Index<String> includes;
void Parse(Stream& in);
void Dump() const;
private:
void CheckEndNamespace(Vector<int>& namespace_block, int level);
};
const PPFile& GetPPFile(const char *path);
String GetIncludePath(const String& s, const String& filedir, const String& include_path);
bool IncludesFile(const String& parent_path, const String& header_path, const String& include_path);
struct Cpp {
bool incomment;
bool done;
String include_path;
VectorMap<String, CppMacro> macro;
String output;
Index<String> usedmacro;
Index<String> definedmacro;
Index<String> namespace_using;
Vector<String> namespace_stack;
void Define(const char *s);
static const char *SkipString(const char *s);
void ParamAdd(Vector<String>& param, const char *b, const char *e);
String Expand(const char *s, Index<String>& notmacro);
String Expand(const char *s);
void Do(const String& sourcefile, Stream& in, const String& currentfile,
Index<String>& visited, const Index<String> *get_macros);
bool Preprocess(const String& sourcefile, Stream& in, const String& currentfile,
const Index<String> *get_macros = NULL);
typedef Cpp CLASSNAME;
};
=======
>>>>>>> .r8434
#endif

View file

@ -1,82 +0,0 @@
<<<<<<< .mine
30214154=======
Gather files 0.375
Checking files 0.031
Removing files 0.000
Parsing files 5.125
TIMING PP_DEFINE : 0.00 ns - 0.00 ns (593.00 ms / 12471437 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 12471437
TIMING Parse : 636.94 ms - 554.35 us (637.00 ms / 1149 ), min: 0.00 ns, max: 16.00 ms, nesting: 1 - 1149
TIMING Expand : 424.95 ms - 376.39 us (425.00 ms / 1129 ), min: 0.00 ns, max: 38.00 ms, nesting: 1 - 1129
TIMING macros : 500.95 ms - 443.71 us (501.00 ms / 1129 ), min: 0.00 ns, max: 2.00 ms, nesting: 1 - 1129
TIMING Gather IDs : 208.95 ms - 185.07 us (209.00 ms / 1129 ), min: 0.00 ns, max: 9.00 ms, nesting: 1 - 1129
TIMING GetMasterFile : 742.94 ms - 646.60 us (743.00 ms / 1149 ), min: 0.00 ns, max: 4.00 ms, nesting: 1 - 1149
TIMING Preprocess : 3.25 s - 2.83 ms ( 3.25 s / 1149 ), min: 0.00 ns, max: 45.00 ms, nesting: 1 - 1149
TIMING GetIncludePath : 190.24 ms - 420.12 ns (212.00 ms / 452817 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 452817
TIMING sCppFile make : 999.95 us - 999.95 us ( 1.00 ms / 1 ), min: 1.00 ms, max: 1.00 ms, nesting: 1 - 1
Gather files 0.375
Checking files 0.016
Removing files 0.000
Parsing files 6.531
TIMING PP_DEFINE : 1.67 s - 134.20 ns ( 2.30 s / 12471407 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 12471407
TIMING Parse : 676.94 ms - 589.16 us (677.00 ms / 1149 ), min: 0.00 ns, max: 27.00 ms, nesting: 1 - 1149
TIMING Expand : 523.94 ms - 464.08 us (524.00 ms / 1129 ), min: 0.00 ns, max: 39.00 ms, nesting: 1 - 1129
TIMING GetMasterFile : 728.94 ms - 634.41 us (729.00 ms / 1149 ), min: 0.00 ns, max: 4.00 ms, nesting: 1 - 1149
TIMING Preprocess : 4.41 s - 3.84 ms ( 4.41 s / 1149 ), min: 0.00 ns, max: 50.00 ms, nesting: 1 - 1149
TIMING GetIncludePath : 189.15 ms - 417.72 ns (212.00 ms / 452817 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 452817
TIMING sCppFile make : 999.95 us - 999.95 us ( 1.00 ms / 1 ), min: 1.00 ms, max: 1.00 ms, nesting: 1 - 1
* c:\upp\cppide.exe 29.03.2015 22:44:02, user: cxl
Gather files 0.375
Checking files 0.016
Removing files 0.000
Parsing files 5.109
TIMING PP_DEFINE : 0.00 ns - 0.00 ns (609.00 ms / 12471437 ), min: 0.00 ns, max: 2.00 ms, nesting: 1 - 12471437
TIMING Parse : 658.94 ms - 573.49 us (659.00 ms / 1149 ), min: 0.00 ns, max: 16.00 ms, nesting: 1 - 1149
TIMING Expand : 408.94 ms - 362.22 us (409.00 ms / 1129 ), min: 0.00 ns, max: 38.00 ms, nesting: 1 - 1129
TIMING macros : 487.94 ms - 432.19 us (488.00 ms / 1129 ), min: 0.00 ns, max: 2.00 ms, nesting: 1 - 1129
TIMING add macro : 65.11 ms - 30.71 ns (169.00 ms / 2120492 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 2120492
TIMING Gather IDs : 382.94 ms - 339.19 us (383.00 ms / 1129 ), min: 0.00 ns, max: 16.00 ms, nesting: 1 - 1129
TIMING GetMasterFile : 705.94 ms - 614.40 us (706.00 ms / 1149 ), min: 0.00 ns, max: 5.00 ms, nesting: 1 - 1149
TIMING Preprocess : 3.32 s - 2.89 ms ( 3.32 s / 1149 ), min: 0.00 ns, max: 45.00 ms, nesting: 1 - 1149
TIMING GetIncludePath : 188.82 ms - 416.98 ns (211.00 ms / 452817 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 452817
TIMING PP read : 302.94 ms - 263.43 us (303.00 ms / 1150 ), min: 0.00 ns, max: 10.00 ms, nesting: 1 - 1150
TIMING sCppFile make : 999.95 us - 999.95 us ( 1.00 ms / 1 ), min: 1.00 ms, max: 1.00 ms, nesting: 1 - 1
* c:\upp\cppide.exe 30.03.2015 22:21:31, user: cxl
Gather files 0.687
Checking files 0.032
Removing files 0.000
Parsing files 3.281
TIMING PP_DEFINES : 0.00 ns - 0.00 ns ( 5.00 ms / 154902 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 154902
TIMING Parse : 631.95 ms - 551.44 us (632.00 ms / 1146 ), min: 0.00 ns, max: 26.00 ms, nesting: 1 - 1146
TIMING Expand include : 10.90 ms - 4.96 us (11.00 ms / 2199 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 2199
TIMING Expand expand : 544.38 ms - 831.97 ns (574.00 ms / 654331 ), min: 0.00 ns, max: 16.00 ms, nesting: 1 - 654331
TIMING Expand define : 13.69 ms - 268.12 ns (16.00 ms / 51057 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 51057
TIMING Expand : 737.95 ms - 655.37 us (738.00 ms / 1126 ), min: 0.00 ns, max: 39.00 ms, nesting: 1 - 1126
TIMING GetMasterFile : 695.95 ms - 607.28 us (696.00 ms / 1146 ), min: 0.00 ns, max: 4.00 ms, nesting: 1 - 1146
TIMING Preprocess : 1.59 s - 1.38 ms ( 1.59 s / 1146 ), min: 0.00 ns, max: 41.00 ms, nesting: 1 - 1146
TIMING GetIncludePath : 188.51 ms - 416.39 ns (209.00 ms / 452724 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 452724
TIMING PP read : 492.95 ms - 429.77 us (493.00 ms / 1147 ), min: 0.00 ns, max: 11.00 ms, nesting: 1 - 1147
TIMING sCppFile make : 999.95 us - 999.95 us ( 1.00 ms / 1 ), min: 1.00 ms, max: 1.00 ms, nesting: 1 - 1
Gather files 0.375
Checking files 0.016
Removing files 0.000
Parsing files 3.297
TIMING PP_DEFINES : 869.25 us - 5.61 ns ( 7.00 ms / 154902 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 154902
TIMING Parse : 656.95 ms - 573.26 us (657.00 ms / 1146 ), min: 0.00 ns, max: 25.00 ms, nesting: 1 - 1146
TIMING Expand include : 4.91 ms - 2.23 us ( 5.00 ms / 2199 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 2199
TIMING Expand expand : 517.10 ms - 790.28 ns (543.00 ms / 654331 ), min: 0.00 ns, max: 16.00 ms, nesting: 1 - 654331
TIMING Expand define : 19.98 ms - 391.31 ns (22.00 ms / 51057 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 51057
TIMING Expand : 731.96 ms - 650.05 us (732.00 ms / 1126 ), min: 0.00 ns, max: 40.00 ms, nesting: 1 - 1126
TIMING GetMasterFile : 699.95 ms - 610.78 us (700.00 ms / 1146 ), min: 0.00 ns, max: 4.00 ms, nesting: 1 - 1146
TIMING Preprocess : 1.58 s - 1.38 ms ( 1.58 s / 1146 ), min: 0.00 ns, max: 41.00 ms, nesting: 1 - 1146
TIMING GetIncludePath : 166.08 ms - 366.85 ns (184.00 ms / 452724 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 452724
TIMING PP read : 315.95 ms - 275.46 us (316.00 ms / 1147 ), min: 0.00 ns, max: 11.00 ms, nesting: 1 - 1147
TIMING sCppFile make : 999.96 us - 999.96 us ( 1.00 ms / 1 ), min: 1.00 ms, max: 1.00 ms, nesting: 1 - 1
>>>>>>> .r8434

View file

@ -1,21 +0,0 @@
uses
Core,
CppBase;
file
cpp.h,
<<<<<<< .mine
util.cpp,
macro.cpp,
ppfile.cpp,
cpp.cpp,
=======
>>>>>>> .r8434
main.cpp,
test.h,
testfile,
cpp.txt;
mainconfig
"" = "";

View file

@ -1,5 +0,0 @@
#ifndef _cpp2_icpp_init_stub
#define _cpp2_icpp_init_stub
#include "Core/init"
#include "CppBase/init"
#endif

View file

@ -1,129 +0,0 @@
#include "cpp.h"
Vector<String> errs;
void AddError(const String& path, int ln, const String& s)
{
errs.Add(path + " " + AsString(ln) + ": " + s);
}
String include_path =
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Vc\\Include;C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Include;C:\\OpenSSL-Win32\\include;C:\\u\\pgsql\\include;C:\\u\\OpenSSL-Win32\\include;"
"C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\Vc\\Include;C:\\Program Files\\Microsoft SDKs\\Windows\\v7.0\\Include;C:\\u\\OpenSSL-Win32\\include;C:\\u\\pgsql\\include;C:\\Program Files (x86)\\MySQL\\MySQL Connector C 6.1\\include;"
";c:/u/upp.src/uppsrc";
void Test(const char *sourcefile, const char *currentfile)
{
DUMP(sourcefile);
DUMP(currentfile);
Cpp cpp;
cpp.include_path = include_path;
FileIn in(sourcefile);
{ RTIMING("Preprocess");
cpp.Preprocess(sourcefile, in, currentfile);
DUMP(cpp.namespace_stack);
<<<<<<< .mine
DUMP(cpp.output);
=======
>>>>>>> .r8434
DUMP(cpp.usedmacro);
<<<<<<< .mine
DUMP(cpp.definedmacro);
=======
DUMP(cpp.macro.GetCount());
>>>>>>> .r8434
}
LOG("=================================");
<<<<<<< .mine
/*
=======
LOG(cpp.output);
>>>>>>> .r8434
/*
{
Cpp cpp2;
cpp2.include_path = include_path;
cpp2.Preprocess(sourcefile, NilStream(), currentfile, &cpp.usedmacro);
DUMP(cpp2.macro);
}
*/
for(int i = 0; i < 100; i++)
{
RTIMING("GetMacros");
Cpp cpp2;
cpp2.include_path = include_path;
cpp2.Preprocess(sourcefile, NilStream(), currentfile, &cpp.usedmacro);
}
*/
}
void TestC(const char *ln)
{
for(int q = 0; q < 2; q++) {
bool incomment = q;
String l = ln;
DUMP(incomment);
LOG(l);
RemoveComments(l, incomment);
LOG(l);
LOG(incomment);
LOG("-----------------------");
}
}
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_FILE, NULL, 150000000);
// Test(GetDataFile("testfile"));
// Test("c:/u/upp.src/uppsrc/CtrlLib/EditField.cpp");
// getchar();
// PPFile f;
// FileIn in(GetDataFile("test.h"));
// f.Parse(in);
// f.Dump();
GetPPFile("C:\\u\\upp.src\\uppsrc\\Core\\Core.h").Dump();
DLOG("==============");
Test("C:\\u\\upp.src\\uppsrc\\Core\\Format.h", "C:\\u\\upp.src\\uppsrc\\Core\\Format.cpp");
return;
<<<<<<< .mine
#endif
{
RTIMING("Pass1");
Test("C:\\u\\upp.src\\uppsrc\\Core\\Topt.h", "C:\\u\\upp.src\\uppsrc\\Core\\Format.cpp");
}
#ifndef _DEBUG
for(int i = 0; i < 100; i++) {
Test("C:\\u\\upp.src\\uppsrc\\Core\\Format.h", "C:\\u\\upp.src\\uppsrc\\Core\\Format.cpp");
}
#endif
#if 0
{
RTIMING("Pass1");
Index<String> visited;
// RecursePP("c:/u/upp.src/uppsrc/CtrlLib/EditField.cpp", include_path, visited);
}
DDUMP(IncludesFile("c:/u/upp.src/uppsrc/CtrlLib/EditField.cpp", "c:/u/upp.src/uppsrc/Core/Core.h", include_path));
DDUMP(IncludesFile("c:/u/upp.src/uppsrc/CtrlLib/EditField.cpp", "c:/u/upp.src/uppsrc/Core/Core2.h", include_path));
for(int i = 0; i < 1000; i++) {
RTIMING("IncludesFile true");
IncludesFile("c:/u/upp.src/uppsrc/CtrlLib/EditField.cpp", "c:/u/upp.src/uppsrc/Core/Core.h", include_path);
}
for(int i = 0; i < 1000; i++) {
RTIMING("IncludesFile false");
IncludesFile("c:/u/upp.src/uppsrc/CtrlLib/EditField.cpp", "c:/u/upp.src/uppsrc/Core/Core1.h", include_path);
}
#endif
// GetPPFile(GetDataFile("test.h")).Dump();
return;
=======
>>>>>>> .r8434
}
// TEST:a,b:|a|b|\n

View file

@ -1,182 +0,0 @@
#include <string.h>
#include <winbase.h>
#include <wingdi.h>
#include <winuser.h>
#define eprintf(x, ...) if(x) printf(__VA_ARGS__)
eprintf(TEST, "%d is %d", a, b, c)
#define TEST test_expanded
TEST /* TEST in comment */ TEST
/* TEST in comment 2
TEST second line
*/ TEST
TEST // TEST
#undef TEST
This should not be expanded, it was undefined: TEST
#define __Expand1(x) x(1)
#define __Expand2(x) __Expand1(x) x(2)
#define __Expand3(x) __Expand2(x) x(3)
#define __Expand4(x) __Expand3(x) x(4)
#define __Expand5(x) __Expand4(x) x(5)
#define __Expand6(x) __Expand5(x) x(6)
#define __Expand7(x) __Expand6(x) x(7)
#define __Expand8(x) __Expand7(x) x(8)
#define __Expand9(x) __Expand8(x) x(9)
#define __Expand10(x) __Expand9(x) x(10)
#define __Expand11(x) __Expand10(x) x(11)
#define __Expand12(x) __Expand11(x) x(12)
#define __Expand13(x) __Expand12(x) x(13)
#define __Expand14(x) __Expand13(x) x(14)
#define __Expand15(x) __Expand14(x) x(15)
#define __Expand16(x) __Expand15(x) x(16)
#define __Expand17(x) __Expand16(x) x(17)
#define __Expand18(x) __Expand17(x) x(18)
#define __Expand19(x) __Expand18(x) x(19)
#define __Expand20(x) __Expand19(x) x(20)
#define __Expand21(x) __Expand20(x) x(21)
#define __Expand22(x) __Expand21(x) x(22)
#define __Expand23(x) __Expand22(x) x(23)
#define __Expand24(x) __Expand23(x) x(24)
#define __Expand25(x) __Expand24(x) x(25)
#define __Expand26(x) __Expand25(x) x(26)
#define __Expand27(x) __Expand26(x) x(27)
#define __Expand28(x) __Expand27(x) x(28)
#define __Expand29(x) __Expand28(x) x(29)
#define __Expand30(x) __Expand29(x) x(30)
#define __Expand31(x) __Expand30(x) x(31)
#define __Expand32(x) __Expand31(x) x(32)
#define __Expand33(x) __Expand32(x) x(33)
#define __Expand34(x) __Expand33(x) x(34)
#define __Expand35(x) __Expand34(x) x(35)
#define __Expand36(x) __Expand35(x) x(36)
#define __Expand37(x) __Expand36(x) x(37)
#define __Expand38(x) __Expand37(x) x(38)
#define __Expand39(x) __Expand38(x) x(39)
#define __Expand40(x) __Expand39(x) x(40)
#define __Expand(x) __Expand40(x)
#define __List1(x) x(1)
#define __List2(x) __List1(x), x(2)
#define __List3(x) __List2(x), x(3)
#define __List4(x) __List3(x), x(4)
#define __List5(x) __List4(x), x(5)
#define __List6(x) __List5(x), x(6)
#define __List7(x) __List6(x), x(7)
#define __List8(x) __List7(x), x(8)
#define __List9(x) __List8(x), x(9)
#define __List10(x) __List9(x), x(10)
#define __List11(x) __List10(x), x(11)
#define __List12(x) __List11(x), x(12)
#define __List13(x) __List12(x), x(13)
#define __List14(x) __List13(x), x(14)
#define __List15(x) __List14(x), x(15)
#define __List16(x) __List15(x), x(16)
#define __List17(x) __List16(x), x(17)
#define __List18(x) __List17(x), x(18)
#define __List19(x) __List18(x), x(19)
#define __List20(x) __List19(x), x(20)
#define __List21(x) __List20(x), x(21)
#define __List22(x) __List21(x), x(22)
#define __List23(x) __List22(x), x(23)
#define __List24(x) __List23(x), x(24)
#define __List25(x) __List24(x), x(25)
#define __List26(x) __List25(x), x(26)
#define __List27(x) __List26(x), x(27)
#define __List28(x) __List27(x), x(28)
#define __List29(x) __List28(x), x(29)
#define __List30(x) __List29(x), x(30)
#define __List31(x) __List30(x), x(31)
#define __List32(x) __List31(x), x(32)
#define __List33(x) __List32(x), x(33)
#define __List34(x) __List33(x), x(34)
#define __List35(x) __List34(x), x(35)
#define __List36(x) __List35(x), x(36)
#define __List37(x) __List36(x), x(37)
#define __List38(x) __List37(x), x(38)
#define __List39(x) __List38(x), x(39)
#define __List40(x) __List39(x), x(40)
namespace Test {
using namespace std;
#include "LaterInclude.h"
};
using
namespace
Something::otherline;
namespace
::something::otherthing {
cool!
};
#define E__p(I) p##I
#define ASSTRING_(x) #x
#define ASSTRING(x) ASSTRING_(x)
#define COMBINE__(a, b) a##b
#define COMBINE(a, b) COMBINE__(a, b)
#define COMBINE3__(a, b, c) a##b##c
#define COMBINE3(a, b, c) COMBINE3__(a, b, c)
#define COMBINE4__(a, b, c, d) a##b##c##d
#define COMBINE4(a, b, c, d) COMBINE4__(a, b, c, d)
#define COMBINE5__(a, b, c, d, e) a##b##c##d##e
#define COMBINE5(a, b, c, d, e) COMBINE5__(a, b, c, d, e)
#define E__NFValue(I) const Value& COMBINE(p, I)
#define E__NFBody(I) String Format(const char *fmt, __List##I(E__NFValue));
EXPAND: __Expand20(E__NFBody)
ASSTRING(Just a test)
COMBINE(aaaa, bbbb)
#define TEST(x, y) %x%y%
#define TESTS(x) #x
#define TEST2(x, y) x ## y
#define TEST4 alfa x ## y.r #hahaha
#define TESTX x
#define TESTY haha
#define TESTZ haha
TEST('\1', "\2")
TEST( 1 +1 , 3 )
TEST( "1" "2" ",", ',')
TESTS(a)
TESTS(a x y)
TESTS("A")
TEST2(a, 3)
TEST2(3, a)
TEST2(a, #)
TEST2(a, "X")
TEST2("Y", "X")
TESTX
TESTY
TESTZ
TEST4
#define pow2(x) (x) * (x)
#define dist(a, b) pow2(a.x - b.x) + pow2(a.y - b.y)
dist(x, y);
#define __countof(a) int(sizeof(a) / sizeof(a[0]))
__countof(bla)

View file

@ -1 +0,0 @@
#include <windows.h>

View file

@ -1,45 +0,0 @@
#include "cpp.h"
void SetSpaces(String& l, int pos, int count)
{
StringBuffer s = l;
memset(~s + pos, ' ', count);
l = s;
}
void RemoveComments(String& l, bool& incomment)
{
int q = -1;
int w = -1;
int lim = l.Find("//");
if(incomment)
q = w = 0;
else {
q = l.Find("/*");
if(q >= 0 && q < lim)
w = q + 2;
}
while(q >= 0 && q < lim) {
int eq = l.Find("*/", w);
if(eq < 0) {
incomment = true;
SetSpaces(l, q, l.GetCount() - q);
return;
}
SetSpaces(l, q, eq + 2 - q);
incomment = false;
q = l.Find("/*");
w = q + 2;
}
}
const Index<String>& CppKeywordsIndex()
{
static Index<String> id;
ONCELOCK {
const char **cppk = CppKeyword();
for(int i = 0; cppk[i]; i++)
id.Add(cppk[i]);
}
return id;
}