00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef INC_SML_FILEINFO_H
00022 #define INC_SML_FILEINFO_H
00023
00024 #ifndef INC_MI32_MICALLBACKLIST_H
00025 #include <mi32/micallbacklist.h>
00026 #endif
00027 #ifndef INC_MI32_SIMPLEAR_H
00028 #include <mi32/simplear.h>
00029 #endif
00030 #ifndef WIN32_NATIVE
00031 #include <X11/Intrinsic.h>
00032 #endif
00033
00034 namespace SML {
00035
00036 class CLASS;
00037 class CONTEXT;
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 struct FILEINFO {
00048
00049 FILEINFO () :
00050 handle(0),
00051 ThisClass(0),
00052 blocking(0),
00053 isfile(0),
00054 prevchar(0),
00055 #ifndef WIN32_NATIVE
00056 m_timer(0),
00057 #endif
00058 m_PollInterval(0),
00059 m_conv(0)
00060 { }
00061
00062 virtual ~FILEINFO () { }
00063
00064 void *handle;
00065 CLASS *ThisClass;
00066 int blocking;
00067 int isfile;
00068
00069 void Close (
00070 ) { v_Close(); }
00071
00072 INT32 Read (
00073 UINT8* buf,
00074 INT32 BytesToRead,
00075 CONTEXT* context
00076 ) { return (v_Read(buf, BytesToRead, context)); }
00077
00078 INT32 Write (
00079 const UINT8* buf,
00080 INT32 BytesToWrite,
00081 CONTEXT* context
00082 ) { return (v_Write(buf, BytesToWrite, context)); }
00083
00084 INT32 ReadASCIINum (
00085 double* pVal,
00086 CONTEXT* context
00087 ) { return (v_ReadASCIINum(pVal, context)); }
00088
00089 bool IsEOF (
00090 ) { return (v_IsEOF()); }
00091
00092 bool IsOpen (
00093 ) const { return (v_IsOpen()); }
00094
00095 INT32 Seek (
00096 INT32 offset,
00097 int mode
00098 ) { return (v_Seek(offset, mode)); }
00099
00100
00101 void Printf(CONTEXT* context, const char* format, ...);
00102
00103 char prevchar;
00104 MICALLBACKLIST m_cblist;
00105 INT32 m_PollInterval;
00106 void* m_conv;
00107 #ifndef WIN32_NATIVE
00108 XtIntervalId m_timer;
00109 #endif
00110 private:
00111 virtual void v_Close();
00112 virtual INT32 v_Read(UINT8* buf, INT32 BytesToRead, CONTEXT* context);
00113 virtual INT32 v_Write(const UINT8* buf, INT32 BytesToWrite, CONTEXT* context);
00114 virtual INT32 v_ReadASCIINum(double* pVal, CONTEXT* context);
00115 virtual bool v_IsEOF();
00116 virtual bool v_IsOpen() const;
00117 virtual INT32 v_Seek(INT32, int);
00118 };
00119
00120 }
00121
00122 typedef SML::FILEINFO SMLFILEINFO;
00123
00124 #endif // INC_SML_FILEINFO_H
00125
00126