00001 /** 00002 * \file msys.h <mi32/msys.h> 00003 * \brief System functions 00004 * 00005 * \if NODOC 00006 * $Id: msys.h_v 1.13 2003/09/15 13:49:56 fileserver!dwilliss Exp $ 00007 * 00008 * $Log: msys.h_v $ 00009 * Revision 1.13 2003/09/15 13:49:56 fileserver!dwilliss 00010 * Doxygen 00011 * 00012 * Revision 1.12 2003/06/12 15:31:19 dwilliss 00013 * Added CHILDPROCESS_XXX defines. These used to be in mbfdefns.h, but that 00014 * file no longer exists 00015 * 00016 * Revision 1.11 2003/04/01 15:14:11 mju 00017 * Add MsysAppGetProductInfo. 00018 * 00019 * Revision 1.10 2003/02/11 15:30:01 scowan 00020 * Changed C linkage run process name. 00021 * 00022 * Revision 1.9 2002/04/10 14:43:28 dwilliss 00023 * Fixed so that it can still be included even if not compiling for C++ 00024 * Yes, this is still an issue with 3rd party libs that we've patched. 00025 * 00026 * Revision 1.8 2002/01/21 15:03:46 mju 00027 * Add 'procname' to MsysAppInitialize(). 00028 * 00029 * Revision 1.7 2002/01/17 23:51:34 mju 00030 * Add MsysAppInitialize. 00031 * 00032 * Revision 1.6 2002/01/10 15:47:33 mju 00033 * Add MsysAppOnExitFuncAdd/Remove. 00034 * 00035 * Revision 1.5 2002/01/10 14:26:20 mju 00036 * Use const in RunProcess. 00037 * 00038 * Revision 1.4 2002/01/09 22:04:14 mju 00039 * Add MsysAppCleanup. 00040 * Rename Get/SetAppName as AppGet/SetName. 00041 * 00042 * Revision 1.3 2002/01/09 14:19:28 mju 00043 * Add RunProcess prototype. 00044 * 00045 * Revision 1.2 2002/01/08 23:11:13 mju 00046 * Add MsysOpenReferenceDocument and MsysRunAssocApp. 00047 * 00048 * Revision 1.1 2002/01/08 18:52:03 mju 00049 * Initial revision 00050 * \endif 00051 **/ 00052 00053 #ifndef INC_MI32_MSYS_H 00054 #define INC_MI32_MSYS_H 00055 00056 #ifndef INC_MI32_STDDEFNS_H 00057 #include <mi32/stddefns.h> 00058 #endif 00059 00060 #ifdef __cplusplus 00061 class MISTRING; 00062 #endif 00063 00064 00065 //! Perform application cleanup prior to exit. 00066 //! Calls registered OnExit functions, disconnects from RVC, etc. 00067 void MsysAppCleanup ( 00068 ); 00069 00070 //! Get application name. 00071 //! @return Pointer to application name. 00072 //! Do NOT free the pointer returned. 00073 const char* MsysAppGetName ( 00074 ); 00075 00076 #ifdef __cplusplus 00077 //! Get descriptive information about product for use in 'Help About' dialogs. 00078 void MsysAppGetProductInfo ( 00079 MISTRING& string //!< String returned. 00080 ); 00081 #endif 00082 00083 #ifdef __cplusplus 00084 //! Initialize application. 00085 void MsysAppInitialize ( 00086 const char *procname, //!< Process name for default INI and msgfile group, NULL to not set 00087 UINT32 ProductCode = 0 //!< ID of product, 0 for TNTmips 00088 ); 00089 #else 00090 #ifndef GENERATING_DOXYGEN_OUTPUT 00091 //! version without default args for things that don't compile for C++ 00092 void MsysAppInitialize ( 00093 const char *procname, 00094 UINT32 ProductCode 00095 ); 00096 #endif //!< GENERATING_DOXYGEN_OUTPUT 00097 #endif 00098 00099 #ifdef __cplusplus 00100 //! Add function to be called on application exit during MsysAppCleanup(). 00101 //! Functions are called starting with the most recently added. 00102 void MsysAppOnExitFuncAdd ( 00103 void (*pfunc)(void*), //! Pointer to function to call 00104 void *pdata = 0 //!< Optional data to passe to function 00105 ); 00106 #else 00107 #ifndef GENERATING_DOXYGEN_OUTPUT 00108 //! version without default args for things that don't compile for C++ 00109 //! Add function to be called on application exit during MsysAppCleanup(). 00110 //! Functions are called starting with the most recently added. 00111 void MsysAppOnExitFuncAdd ( 00112 void (*pfunc)(void*), 00113 void *pdata 00114 ); 00115 #endif //!< GENERATING_DOXYGEN_OUTPUT 00116 #endif 00117 00118 #ifdef __cplusplus 00119 //! Remove previously added OnExit function. 00120 void MsysAppOnExitFuncRemove ( 00121 void (*pfunc)(void*), //! Pointer to function to remove 00122 void *pdata = 0 //!< Optional data, must match value used in MsysAppOnExitFuncAdd 00123 ); 00124 #else 00125 #ifndef GENERATING_DOXYGEN_OUTPUT 00126 //! version without default args for things that don't compile for C++ 00127 void MsysAppOnExitFuncRemove ( 00128 void (*pfunc)(void*), 00129 void *pdata 00130 ); 00131 #endif //!< GENERATING_DOXYGEN_OUTPUT 00132 #endif 00133 00134 //! Set application "name" for later retrieval by MsysAppGetName(). 00135 void MsysAppSetName ( 00136 const char *newname //!< New application name to set 00137 ); 00138 00139 //! Get IP address of local machine. 00140 //! Returns 'true' if X server and client are on same machine (or if not X platform). 00141 bool MsysGetLocalIP ( 00142 UINT8 ip[6] //!< IP address returned if available 00143 ); 00144 00145 //! Open 'reference' document using specified tag. 00146 //! @return Error < 0, FALSE if unrecognized tag, TRUE if valid tag. 00147 //! Tag must be in one of the forms: 00148 //! 'TNT:refman/file.pdf#NamedDestination' 00149 //! 'TNT:getstart/file.pdf?page=XXX' 00150 //! 'GETSTART:file.pdf' 00151 //! 'FILE:filename' 00152 int MsysOpenReferenceDocument ( 00153 const char *doctag 00154 ); 00155 00156 //! Run application "associated" with given file and pass file as parameter to it. 00157 //! On systems where there is no operating system-defined association system, the associations are 00158 //! specified by extension in the "AppAssoc" section of tnthost.ini. 00159 ERRVALUE MsysRunAssocApp ( 00160 const UNICODE *docname //!< Name of document file 00161 ); 00162 00163 //! Possible "result" values passed to the EndCB of MsysRunProcess 00164 //! These used to be in mbfdefns.h, but that include file is no more. 00165 //! Apparently Windows only uses CHILDPROCESS_Finished. The Unix 00166 //! platforms can get the other values 00167 #define CHILDPROCESS_Finished 0 00168 #define CHILDPROCESS_ExitError 1 00169 #define CHILDPROCESS_ExternalStop 2 00170 #define CHILDPROCESS_DiedCoreDump 3 00171 #define CHILDPROCESS_DiedNoCoreDump 4 00172 00173 #ifdef __cplusplus 00174 //! Function to execute another program. 00175 int MsysRunProcess ( 00176 const UNICODE *progstr, 00177 void (*EndCB)(int pid, int result, void* udata) = 0, 00178 void *udata = 0 00179 ); 00180 #else 00181 #ifndef GENERATING_DOXYGEN_OUTPUT 00182 //! version without default args for things that don't compile for C++ 00183 int MsysRunProcessC ( 00184 const UNICODE *progstr, 00185 void (*EndCB)(int pid, int result, void* udata), 00186 void *udata 00187 ); 00188 #endif //!< GENERATING_DOXYGEN_OUTPUT 00189 #endif 00190 00191 00192 #endif //!< INC_MI32_MSYS_H
1.3.8-20040913