Main Page   Modules   File List   Related Pages   Examples  

tools.h

00001 /*
00002  * tools.h - error handling and filename tools.
00003  *
00004  * code inspired by the books:
00005  *
00006  * The Unix Programming Environment
00007  * Brian W. Kernighan and Rob Pike.
00008  * Prentice Hall, Inc., 1984.
00009  * ISBN 0-13-937681-X (paperback), 0-13-937699-2 (hardback).
00010  *
00011  * The Practice of Programming.
00012  * Brian W. Kernighan and Rob Pike.
00013  * Addison-Wesley, Reading, Massachusetts, 1999.
00014  * ISBN 0-201-61586-X.
00015  *
00016  * $Revision: 1.0 $
00017  * $Date: 2003-03-27 11:52:18+01 $
00018  * $Source: \\\\fwneld\\msdos\\RCS\\K\\bf\\prj\\rulbus-dll\\editenv\\envio\\tools.h,v $
00019  * %Author: Martin J. Moene, Leiden University %
00020  *
00021  * Compiler        : Borland-C++ 5.5.1, GCC 3.2
00022  * Operating system: 32-bit Windows, Unix
00023  * Hardware system : PC, other
00024  *
00025  * This software is released into the public domain.
00026  * You are free to use it in any way you like.
00027  *
00028  * This software is provided "as is" with no expressed
00029  * or implied warranty.  I accept no liability for any
00030  * damage or loss of business that this software may cause.
00031  */
00032 
00040 #ifndef __TOOLS_H
00041 #define __TOOLS_H
00042 
00043 #if defined( __BORLANDC__ )
00044 #   include   <stdio>           // for FILE
00045 #   include  <string>           // for class string
00046 #elif defined( __MINGW32__ ) || defined( __GNUC__ )
00047 #   include  <cstdio>           // for FILE
00048 #   include  <string>           // for class string
00049 #else
00050 #error Unhandled compiler-specific include file selection.
00051 #endif
00052 
00053 using namespace std;
00054 
00059 enum            // program return codes
00060 {
00061    E_OK,        
00062    E_OPT,       
00063    E_PS,        
00064    E_INT,       
00065    E_ITL        
00066 };
00067 
00072 enum            // message levels
00073 {
00074    MSG_L0,      
00075    MSG_L1,      
00076    MSG_L2       
00077 };
00078 
00083 enum            // debug levels
00084 {
00085    DBG_L0,      
00086    DBG_L1,      
00087    DBG_L2       
00088 };
00089 
00090 /*
00091  * prototypes:
00092  */
00093 
00094 const char *getprogname();
00095 void        setprogname( const char *name );
00096 
00097 int         getmsglevel(            );
00098 void        setmsglevel( int  level );
00099 FILE *      getmsgfile (            );
00100 void        setmsgfile ( FILE *file );
00101 
00102 int         getdbglevel(            );
00103 void        setdbglevel( int  level );
00104 FILE *      getdbgfile (            );
00105 void        setdbgfile ( FILE *file );
00106 
00107 const char *dirname    ( const char *pathname );
00108 const char *basename   ( const char *pathname );
00109 const char *extname    ( const char *pathname );
00110 
00111 int         exist      ( const char *filename );
00112 
00113 int         error      ( int status, const char *format ...);
00114 int         message    ( int level , const char *format ...);
00115 int         debug      ( int level , const char *format ...);
00116 
00117 string      prompt     ( const char *ps );
00118 int         pick       ( int isInteractive, const char *arg, const char *set = "yY" );
00119 int         ttyin      ( );
00120 
00121 #endif  // __TOOLS_H
00122 
00123 /* @} \endimplementation */
00124 
00125 /*
00126  * end of file
00127  */
00128 

Generated on Tue Apr 29 11:20:45 2003 for Edit Env by doxygen 1.3