00001
00009 #ifndef HAIO_H
00010 #define HAIO_H
00011
00012 #if defined(__xlC__)
00013
00014 #include <stdio.h>
00015 #include <iostream.h>
00016 #include <fstream.h>
00017 #include <strstream.h>
00018 #include <iomanip.h>
00019
00020 #else
00021
00022 #ifdef _MSC_VER
00023
00024 #pragma warning (disable:4786)
00025 #define DllImport __declspec( dllimport )
00026 #define DllExport __declspec( dllexport )
00027
00028 #else
00029 #define DllExport
00030 #define DllImport
00031 #endif
00032
00033 #include <stdio.h>
00034 #include <iostream>
00035 #include <fstream>
00036 #include <strstream>
00037 #include <iomanip>
00038
00039 #if defined(_MSC_VER)
00040 using namespace std;
00041
00042 typedef struct DIR DIR;
00043
00044 struct dirent
00045 {
00046 char *d_name;
00047 };
00048
00049 DIR *opendir(const char *);
00050 int closedir(DIR *);
00051 struct dirent *readdir(DIR *);
00052 void rewinddir(DIR *);
00053 #else
00054 #include <dirent.h>
00055 #endif
00056
00057 #if !defined(__xlC__) && !defined(__DECCXX)
00058 typedef ostream ostream_withassign;
00059 #endif
00060
00061 #endif
00062
00063 extern bool find_line_in_file(FILE* fp, const char* str_comp, char* cur_line, const int len, const bool rew= false);
00064
00065 extern "C"
00066 {
00067 extern int ErrorMessage(const char* str);
00068 extern int PrintMessage(const char* str);
00069 extern int copy_file(const char* src, const char* tgt, const int mode = 0);
00070 extern int delete_file( const char* fname);
00071 extern void RedirectIOToConsole();
00072 extern int RedirectIOToFile(const char* fname);
00073 extern int RestoreIOToConsole();
00074
00075
00076 #if !defined(HAIO_CPP)
00077 extern int PrintLog(const char* str, ... );
00078 extern int ErrorInMod(const char* module, const char* msg);
00079
00080 #endif
00081
00082 }
00083
00084 class SplitOstream : public ostream
00085 {
00086 public:
00087 SplitOstream(streambuf* psb);
00088 virtual ~SplitOstream();
00089
00090 bool add_stream(ostream* new_ostream);
00091
00092 ostream* second_ostream;
00093
00094 ostream& operator <<( char ch );
00095 ostream& operator <<( unsigned char uch );
00096 ostream& operator <<( signed char sch );
00097 ostream& operator <<( const char* psz );
00098 ostream& operator <<( const unsigned char* pusz );
00099 ostream& operator <<( const signed char* pssz );
00100 ostream& operator <<( short s );
00101 ostream& operator <<( unsigned short us );
00102 ostream& operator <<( int n );
00103 ostream& operator <<( unsigned int un );
00104 ostream& operator <<( long l );
00105 ostream& operator <<( unsigned long ul );
00106 ostream& operator <<( float f );
00107 ostream& operator <<( double d );
00108 ostream& operator <<( const void* pv );
00109 ostream& operator <<( streambuf* psb );
00110 ostream& operator <<( ostream& (*fcn)(ostream&) );
00111 ostream& operator <<( ios& (*fcn)(ios&) );
00112
00113 };
00114
00115
00116 #endif
00117
00118