]> git.saurik.com Git - wxWidgets.git/blob - utils/HelpGen/src/ripper_main.cpp
Deprecated lib tweaks
[wxWidgets.git] / utils / HelpGen / src / ripper_main.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: No names yet.
3 // Purpose: Contrib. demo
4 // Author: Aleksandras Gluchovas
5 // Modified by:
6 // Created: 22/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Aleskandars Gluchovas
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx/wx.h".
13 #include "wx/wxprec.h"
14
15 #ifdef __BORLANDC__
16 #pragma hdrstop
17 #endif
18
19 #ifndef WX_PRECOMP
20 #include "wx/wx.h"
21 #endif
22
23 #ifdef WIN32
24 #include <io.h>
25 #endif
26
27 #include <stdio.h>
28
29 #include "markup.h" // get_HTML_markup_tags() will be used
30
31 #include "docripper.h"
32 #include "cjparser.h" // C++/Java will be parsed here
33
34 /***** Main funciton *****/
35
36 #ifdef WIN32
37
38 // NOTE:: under Windows this generator parses all .h files
39 // int the current directory
40
41 #include "direct.h"
42
43
44 void main(int argc, char** argv)
45 {
46 cout << "C++/JAVA Source Documentation Generator (\"wxDocRipper\")" << endl
47 << "(C) 1998, Aleksandras Gluchovas (mailto:alex@soften.ktu.lt)"
48 << endl << endl;
49
50
51 RipperDocGen gen;
52
53 // set up target script
54 gen.SetScriptMarkupTags( get_HTML_markup_tags() );
55
56 // setup source langauge
57 CJSourceParser* pParser = new CJSourceParser();
58
59 gen.Init( pParser );
60
61 // read process all files in the current directory
62
63 struct _finddata_t c_file; // NT-specific?
64 long hFile;
65
66 hFile = _findfirst( "*.h", &c_file );
67 int total = 0;
68
69 while( hFile != -1L )
70 {
71 gen.ProcessFile( c_file.name );
72 ++total;
73
74 if ( _findnext( hFile, &c_file ) == -1L )
75 break;
76 }
77
78
79 if ( total )
80 {
81 cout << endl
82 << "*** storing source documenation into ./srcref.html ***"
83 << endl << endl;
84
85 if ( !gen.SaveDocument( "srcref.html" ) )
86
87 cout << "\nERROR: document cannot be saved" << endl;
88 }
89 else
90 {
91 cout << "\nno .h files found in this directory - You must be running Windows now :-)"
92 << endl;
93 return;
94 }
95
96
97 printf( "\nTotal %d file(s) processed, done.\n", total );
98 }
99
100
101 #else
102
103 // NOTE:: on platfroms other then Windows this generator parses all files
104 // given from the command line
105
106 int main(int argc, char** argv)
107 {
108 cout << "C++/JAVA Source Documentation Generator (\"wxDocRipper\")" << endl
109 << "(C) 1998, Aleksandras Gluchovas (mailto:alex@soften.ktu.lt)"
110 << endl << endl;
111
112 if ( argc < 2 )
113 {
114 cout << "Usage: list of files with .h, .hpp, .cpp or .java extentions"
115 << endl;
116 return 1;
117 }
118
119 int from = 1, no_dump = 0;
120
121 if ( strcmp( argv[1], "-x" ) == 0 )
122 {
123 from = 2;
124 no_dump = 1;
125 }
126
127 RipperDocGen gen;
128
129 // set up target script
130 gen.SetScriptMarkupTags( get_HTML_markup_tags() );
131
132 // setup source langauge
133 CJSourceParser* pParser = new CJSourceParser();
134
135 gen.Init( pParser );
136
137 for( int i = from; i != argc; ++i )
138
139 gen.ProcessFile( argv[i] );
140
141 if ( !no_dump )
142 {
143 cout << endl
144 << "*** storing source documenation into ./srcref.html ***"
145 << endl << endl;
146
147 if ( !gen.SaveDocument( "srcref.html" ) )
148
149 cout << "\nERROR: document cannot be saved" << endl;
150 }
151
152 printf( "\nTotal %d file(s) processed, done.\n", argc-from );
153
154 return 0;
155 }
156
157 #endif