ultimatepp/uppdev/cpp/main.cpp
cxl c635cd80d2 .developing preprocesor
git-svn-id: svn://ultimatepp.org/upp/trunk@8155 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2015-02-08 18:06:59 +00:00

67 lines
1.3 KiB
C++

#include "cpp.h"
/*
#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\
//h
#define TESTY haha // note\
ble
#define TESTZ haha \
ble
//*
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
//*/
CONSOLE_APP_MAIN
{
/*
{
CppMacro m;
m.body = "a + b * 123 - alfa";
m.param.Add("a");
m.param.Add("b");
Vector<String> x;
x.Add("one");
x.Add("two");
DUMP(m.Expand(x));
}
Cpp x;
x.Define("TEST(a, b) |a|b|");
DUMP(x.Expand("This is: TEST(('\\1' , \"2\" \"4\" '4' ',' \",\"), 3)!"));
DUMP(x.Expand("This is: TEST(1, 2)!"));
DUMP(x.Expand("This is: TEST(1 + a, 2)!"));
DUMP(x.Expand("This is: TEST((1 , 2), 3)!"));
DUMP(x.Expand("This is: TEST( \"1\" \"2\" \",\", ',')!"));
*/
Cpp x;
FileIn in0("C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Vc\\Include\\crtdefs.h");
x.Preprocess(in0);
// FileIn in("C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Vc\\Include\\string.h");
FileIn in(GetDataFile("test.h"));
LOG(x.Preprocess(in));
LOG("---------------------------");
DUMPM(x.macro);
}
// TEST:a,b:|a|b|\n