2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: NodeParser.C /main/6 1996/08/21 15:47:06 drk $ */
27 #include "dti_cc/CC_Stack.h"
28 #include "Exceptions.hh"
32 #include "SearchPath.h"
35 #include "BookTasks.h"
39 #include "dbug.h" /* Fred Fish's dbug.h */
43 //---------------------------------------------------------------------
44 int main(int argc, char **argv)
48 /* can't seem to get C++ initialization stuff to do this... */
51 set_new_handler( FreeStoreException );
56 DBUG_PROCESS(argv[0]);
57 if(getenv("FISH_DBUG")) DBUG_PUSH(getenv("FISH_DBUG"));
62 const char *toc_option = argv[1];
63 const char *infolib = argv[2];
64 const char *srcdir = argv[3];
67 Dispatch::tmpdir = infolib;
68 Dispatch::srcdir = srcdir;
70 if ( !strcmp(toc_option, "toc") ) {
71 Dispatch::tocgen_only = 1;
73 else if ( !strcmp(toc_option, "all") ) {
74 Dispatch::tocgen_only = 0;
77 fprintf(stderr, "usage: NodeParse [ tocgen_only | all ] <database-dir> <source-dir>\n");
85 * Add the . directory as a default if the file is not found in scrdir
88 SearchPath *sptable = new SearchPath( srcdir, ".", 0 );
89 Dispatch::search_path_table = sptable;
91 Task *t = new BookCaseTask( infolib );
92 Stack<int> *istack = new Stack<int>;
94 Dispatch::setRoot(t, istack);
103 catch(Unexpected&, u)
106 Dispatch::tok->reportError(Token::User, Token::Fatal,
107 "markup error: %s", u.msg());
109 catch(ErrorReported&, e)
111 if ( e.f_severity == Token::Fatal ) {
116 catch(PosixError&, pe)
118 fprintf(stderr, "(ERROR) %s\n", pe.msg() );
121 catch(ErrorReported&, e)
123 if ( e.f_severity == Token::Fatal ) {
129 fprintf(stderr, "usage: NodeParse [ tocgen_only | all ] <database-dir> <source-dir>\n");