DCL 3.7.4
Loading...
Searching...
No Matches
hse/HSAIDoc/main.cpp
Go to the documentation of this file.
1#include <dcl/Config.h>
2
3#ifdef __WINNT__
4#include <windows.h>
5#endif
6
7#include <locale.h>
8#include <wchar.h> // wprintf
9
10#include <dcl/Charset.h>
11#include <dcl/FileWriter.h>
12
13#include <dcl/Files.h>
14
15#include "DocSyntax.h"
16#include "DocParser.h"
17#include "HtmlGenerator.h"
18
19__DCL_USING_NAMESPACE
20
21int __main(int argc, char* argv[])
22{
25
26 if (argc < 3) {
27 err << L"Usage: idoc filename idoc.ini" << endl
28 << L"HSAIDocCmd.exe D:/Work/sdn/dcl/hse/HSAIDoc/main.cpp D:/Work/sdn/dcl/hse/HSAIDoc/src2html.ini"
29 << endl;
30 return 0;
31 }
32
33 String filename = LocaleDecoder::decode(argv[1]);
34 String iniFilename = LocaleDecoder::decode(argv[2]);
35
36 if (!Files::exists(filename)) {
37 err << L"Source file is not found! - " << filename << endl;
38 return 0;
39 }
40
41 if (!Files::exists(iniFilename)) {
42 err << L"Ini file is not found! - " << iniFilename << endl;
43 return 0;
44 }
45
46 try {
47 HtmlGenerator gen(iniFilename);
48
49 gen.generateHeader(out, filename);
50 gen.generate(out, filename);
51 gen.generateFooter(out);
52
53 }
54 catch (Exception* e) {
55 err << e->toStringAll();
56 e->destroy();
57 }
58
59 return 0;
60}
61
62int main(int argc, char* argv[])
63{
64 int r = 0;
65 // std::locale::global(std::locale(""));
66 setlocale(LC_ALL, "");
67
69 try {
70#ifdef __DCL_DEBUG
71 FileWriter debugOut(STDERR_HANDLE);
72 DCLDebugSetGlobalReport(&debugOut);
73 try {
74#endif
75
76 r = __main(argc, argv);
77
78#ifdef __DCL_DEBUG
79 }
80 catch (Exception* cause) {
81 debugOut << cause->toStringAll() << endl;
82 cause->destroy();
83 }
84#if __DCL_HAVE_ALLOC_DEBUG
85 DCLDebugDumpGlobalMemoryLeak(DCL_ALLOC_DUMP_ALL, &debugOut);
86#endif
87 DCLDebugSetGlobalReport(NULL);
88#endif // __DCL_DEBUG
89 }
90 catch (Exception* e) {
91 String s = e->toStringAll();
92 e->destroy();
93 wprintf(L"Exception: %ls\n", s.data());
94 }
96
97 return r;
98}
99
100#ifdef __WINNT_NEW_DELETE_OVERRIDE
101#undef new
102__WINNT_NEW_DELETE_OVERRIDE
103#endif
#define NULL
Definition Config.h:312
#define STDOUT_HANDLE
Definition File.h:59
#define STDERR_HANDLE
Definition File.h:60
IOException *size_t r
Definition MediaInfo.cpp:82
#define __DCL_CLEANUP
Definition Object.h:286
#define __DCL_INITIALIZE
Definition Object.h:285
DCLCVAR const struct __endl endl
virtual void destroy()
Definition Exception.cpp:74
String toStringAll() const
Definition Exception.cpp:45
static bool exists(const String &_path)
Definition Files.cpp:109
void generateHeader(Writer &out, const wchar_t *pszHtmlTitle=NULL)
bool generate(Writer &out, const wchar_t *pszFileName, const wchar_t *pszLangSyntax=NULL)
void generateFooter(Writer &out)
int main(int argc, char *argv[])
__DCL_USING_NAMESPACE int __main(int argc, char *argv[])