menusys.h

Go to the documentation of this file.
00001 
00101 #ifndef INCLUDED_menusys
00102 #define INCLUDED_menusys
00103 
00104 #include <vector>
00105 
00117 #ifdef _WIN32
00118 # include <windows.h>
00119 # ifndef USING_ICU
00120 #  include <tchar.h>
00121 # endif
00122 #else
00123 # ifdef _UNICODE
00124 #  include <unicode/utypes.h>   // ICU
00125 #  define TCHAR  UChar
00126 # else
00127 #  define TCHAR  char
00128 # endif
00129 #endif
00130 
00136 typedef std::vector<TCHAR*> MSYS_Args;
00137 
00139 struct MSYS_Thread
00140 {
00141     MSYS_Thread() : mUserData(NULL), mThreadId(-1) { }
00142 
00144     inline int GetThreadId() const { return mThreadId; }
00145 
00150     inline const TCHAR * GetCurrCommand() const { return mCurrCommand; }
00151 
00153     const static int ROOT_THREAD = 0;
00154 
00161     void * mUserData;
00162 
00163 protected:
00164     int             mThreadId;
00165     const TCHAR *   mCurrCommand;
00166 };
00167 
00213 typedef void (*MSYS_Handler)(MSYS_Thread * aThread, MSYS_Args & aArgs);
00214 
00236 struct MSYS_DispatchEntry {
00237     const TCHAR *   cmd;
00238     MSYS_Handler    fn;
00239     bool            unquote;
00240     const TCHAR *   oneHelp;
00241     const TCHAR *   longHelp;
00242 
00243     bool operator==(const MSYS_DispatchEntry & rhs) const;
00244 };
00245 
00253 extern const TCHAR * MSYS_HEADER;
00254 
00311 extern const MSYS_DispatchEntry MSYS_Commands[];
00312 
00328 extern const TCHAR MSYS_DefaultOptionsFile[];
00329 
00349 extern bool
00350 MSYS_Process(
00351     const TCHAR *   aInputFile,
00352     bool            aEnableThreads
00353     );
00354 
00383 extern void
00384 MSYS_ThreadUserCreate(
00385     MSYS_Thread *       aNewThread,
00386     const MSYS_Thread * aParentThread
00387     );
00388 
00412 extern void
00413 MSYS_ThreadUserDestroy(
00414     MSYS_Thread * aThread
00415     );
00416 
00431 extern void
00432 MSYS_GetPrompt(
00433     MSYS_Thread *   aThread,
00434     TCHAR *         aBuf,
00435     size_t          aBufSiz
00436     );
00437 
00447 extern void
00448 MSYS_DisplayOption(
00449     MSYS_Thread *   aThread,
00450     const TCHAR *   aOption,
00451     const TCHAR *   aValue
00452     );
00453 
00471 extern bool
00472 MSYS_NeedHelp(
00473     MSYS_Thread *   aThread,
00474     MSYS_Handler    aHandler,
00475     MSYS_Args &     aArgs,
00476     bool            aShowHelp = true
00477     );
00478 
00487 extern void
00488 MSYS_ShowHelp(
00489     MSYS_Thread *   aThread,
00490     MSYS_Handler    aHandler
00491     );
00492 
00516 extern void
00517 MSYS_Display(
00518     MSYS_Thread *   aThread,
00519     const TCHAR *   aFormat,
00520     ...
00521     );
00522 
00530 extern void
00531 MSYS_DisplayWrapped(
00532     MSYS_Thread *   aThread,
00533     const TCHAR *   aText
00534     );
00535 
00543 #ifdef _WIN32
00544 extern void
00545 MSYS_DisplayWindowsError(
00546     MSYS_Thread *   aThread,
00547     const TCHAR *   aLocation,
00548     HRESULT         aError
00549     );
00550 #endif
00551 
00552 #endif // INCLUDED_menusys

Generated on Wed Jun 20 09:28:35 2007 for menusys by  doxygen 1.5.2