-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmlpgen.cpp
More file actions
59 lines (50 loc) · 1.87 KB
/
xmlpgen.cpp
File metadata and controls
59 lines (50 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// xmlpgen.cpp
// dbien 25DEC2020
// Generate the lexicographical analyzer for the xmlparser implementation using the lexang templates.
// TODO: precompiled headers? probably wouldn't gain too much but it is easy.
#include "xmlpgen.h"
#ifdef __DGRAPH_COUNT_EL_ALLOC_LIFETIME
int gs_iNodesAllocated = 0;
int gs_iLinksAllocated = 0;
int gs_iNodesConstructed = 0;
int gs_iLinksConstructed = 0;
#endif //__DGRAPH_COUNT_EL_ALLOC_LIFETIME
__REGEXP_USING_NAMESPACE
__XMLP_USING_NAMESPACE
std::string g_strProgramName;
int TryMain( int argc, char ** argv );
int
main( int argc, char **argv )
{
#ifdef WIN32
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif //WIN32
try
{
return TryMain( argc, argv );
}
catch ( const std::exception & rexc )
{
n_SysLog::Log( eslmtError, "%s: *** Exception: [%s]", g_strProgramName.c_str(), rexc.what() );
fprintf( stderr, "%s: *** Exception: [%s]\n", g_strProgramName.c_str(), rexc.what() );
return -123;
}
}
// We want to be able to read each format natively. Each will have a different generated DFA but will be able to share the same _lexical_analyzer in the impl.
void GenerateUTF32XmlLex( EGeneratorFamilyDisposition _egfdFamilyDisp );
void GenerateUTF16XmlLex( EGeneratorFamilyDisposition _egfdFamilyDisp );
void GenerateUTF8XmlLex( EGeneratorFamilyDisposition _egfdFamilyDisp );
int
TryMain( int argc, char ** argv )
{
g_strProgramName = *argv;
n_SysLog::InitSysLog( argv[0],
/*LOG_PERROR*/0, LOG_USER
);
// The "base" generator generates the lexicographical analyzer template as well as the state machine.
// The "specialized" generators are only state machines and they share the lexicographical analyzer template.
GenerateUTF32XmlLex( egfdBaseGenerator );
GenerateUTF16XmlLex( egfdSpecializedGenerator );
GenerateUTF8XmlLex( egfdSpecializedGenerator );
return 0;
}