*
* LDC2 source code
*
- * $Date: 2007/03/26 01:00:40 $
+ * $Date: 2007/03/26 01:15:21 $
* $Author: hachti $
*
* $Log: main.cpp,v $
- * Revision 2.0 2007/03/26 01:00:40 hachti
+ * Revision 2.1 2007/03/26 01:15:21 hachti
+ * *** empty log message ***
+ *
+ * Revision 2.0 2007-03-26 01:00:40 hachti
* *** empty log message ***
*
*
******************************************************************************/
-/* ldc2 preliminary main program */
-
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <vector>
#include <string>
-
+
#include "config.hh"
#include "tool.hh"
static int warnings=0;
static int errcode=0; //! Variable for error codes.
-
+/******************************************************************************/
+/*!
+ *\brief Error exit routine.
+ *
+ * This routine tests the global error counter and terminates the program
+ * if necessary.
+ */
void exit_on_error(){
if (errors){
fprintf(stderr,"Failed. (%i)\n",errcode);
if (fd<0){
fprintf(stderr,"Error: could not open file \"%s\" for writing!\n",
filename);
- exit (1);
+ errors++;
+ errcode=1;
+ return;
}
}
if (fd_numbered<0){
fprintf(stderr,"Error: could not open file \"%s\" for writing!\n",
filename_numbered);
- exit (1);
+ errors++;
+ errcode=1;
+ return;
}
}
in_object=true;
catch (tape_block::io_error_exception e){
fprintf(stderr,"Error: could write to file \"%s\"!\n",
filename);
- exit (1);
+ errors++;
+ errcode=1;
+ return;
}
} // if (cfg_split_objects)
catch (tape_block::io_error_exception e){
fprintf(stderr,"Error: could write to file \"%s\"!\n",
filename_numbered);
- exit (1);
+ errors++;
+ errcode=1;
+ return;
}
} // if (cfg_split_objects_numbered)
if (fd_block<0){
fprintf(stderr,"Error: could not open file \"%s\" for writing!\n",
fname);
- exit (1);
+ errors++;
+ errcode=1;
+ return;
}
try{
block->dump_to_fd(fd_block);
catch (tape_block::io_error_exception e){
fprintf(stderr,"Error: could write to file \"%s\"!\n",
fname);
- exit (1);
+ errors++;
+ errcode=1;
+ return;
}
close(fd_block);
}
return;
}
}
-
-
} // process_tape()
+/******************************************************************************/
+/*!
+ *\brief Everything that has to do with symbol listing.
+ */
void process_called_imports(){
vector<string>exported;
vector<string>called;
/******************************************************************************/
/*!
*\brief The main routine.
+ *
*/
int main(int argc, char ** args){