home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 September / CHIP_CD_1997_09_PL.iso / software / testsoft / labwind / demo.6 / main / include / utility.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-02  |  11.7 KB  |  294 lines

  1. /*============================================================================*/
  2. /*                       L a b W i n d o w s / C V I                          */
  3. /*----------------------------------------------------------------------------*/
  4. /*    Copyright (c) National Instruments 1987-1996.  All Rights Reserved.     */
  5. /*----------------------------------------------------------------------------*/
  6. /*                                                                            */
  7. /* Title:   utility.h                                                         */
  8. /* Purpose: Include file for LabWindows/CVI Utility Library.                  */
  9. /*                                                                            */
  10. /*============================================================================*/
  11.  
  12. #ifndef UTILITY_HEADER
  13. #define UTILITY_HEADER
  14.  
  15. #include "cvidef.h"
  16. #include "cvirte.h"
  17.  
  18. #ifdef __cplusplus
  19.     extern "C" {
  20. #endif
  21.  
  22.  
  23. #define VAL_AUTO_CENTER 0x80000000L    /* for SetStdioWindowPosition() */
  24.  
  25. #if defined(_NI_mswin16_)
  26. #define MAX_PATHNAME_LEN   80    /* includes nul byte */
  27. #define MAX_DRIVENAME_LEN   3    /* includes nul byte */
  28. #define MAX_DIRNAME_LEN    66    /* includes nul byte */
  29. #define MAX_FILENAME_LEN   13    /* includes nul byte */
  30.  
  31. #elif defined(_NI_mswin32_)
  32. #define MAX_PATHNAME_LEN  260    /* includes nul byte */
  33. #define MAX_DRIVENAME_LEN   3    /* includes nul byte */
  34. #define MAX_DIRNAME_LEN   256    /* includes nul byte */
  35. #define MAX_FILENAME_LEN  256    /* includes nul byte */
  36.  
  37. #elif defined(_NI_unix_) || defined(_NI_sparc_)
  38. #define MAX_PATHNAME_LEN  256    /* recommended buffer size for paths */
  39. #define MAX_DRIVENAME_LEN   1    /* includes nul byte */
  40. #define MAX_DIRNAME_LEN   256    /* includes nul byte */
  41. #define MAX_FILENAME_LEN  256    /* recommended buffer size for file names */
  42.  
  43. #elif defined(_NI_mac_)
  44. #define MAX_PATHNAME_LEN  256    /* includes nul byte */
  45. #define MAX_DRIVENAME_LEN   1    /* includes nul byte */
  46. #define MAX_DIRNAME_LEN   256    /* includes nul byte */
  47. #define MAX_FILENAME_LEN  256    /* includes nul byte */
  48.  
  49. #else
  50. #error Undefined Platform. You need to add one of the
  51. #error following to your compiler defines:
  52. #error     Platform                      Preprocessor directive
  53. #error Microsoft Windows 3.1           #define _NI_mswin16_
  54. #error Windows 95/NT                   #define _NI_mswin32_
  55. #error Solaris 1                       #define _NI_sparc_       1
  56. #error Solaris 2                       #define _NI_sparc_       2
  57. #error
  58. #error _NI_i386_ has been replaced with _NI_mswin16_.
  59. #error See Programmers Reference Manual for more information.
  60.  
  61.  
  62. #endif
  63.  
  64.  
  65. #if defined(_NI_mswin_) || defined(_NI_mswin16_) || defined(_NI_mswin32_)
  66. /* LaunchExecutableEx window display options */
  67. #define LE_HIDE         0
  68. #define LE_SHOWNORMAL       1
  69. #define LE_SHOWMINIMIZED    2
  70. #define LE_SHOWMAXIMIZED    3
  71. #define LE_SHOWMINNOACTIVE  7
  72. #define LE_SHOWNA           8
  73.  
  74. /* SystemHelp commands */
  75. #if !defined(HELP_CONTEXT)     /* prevent warnings when SDK files are used */
  76. #define HELP_CONTEXT        0x0001
  77. #define HELP_QUIT           0x0002
  78. #define HELP_CONTENTS       0x0003
  79. #define HELP_HELPONHELP     0x0004
  80. #define HELP_SETCONTENTS    0x0005
  81. #define HELP_CONTEXTPOPUP   0x0008
  82. #define HELP_KEY            0x0101
  83. #define HELP_COMMAND        0x0102
  84. #define HELP_PARTIALKEY     0x0105
  85. #if defined(_NI_mswin32_)
  86. #define HELP_FINDER         0x000b
  87. #endif /* defined(_NI_mswin32_) */
  88. #endif /* !defined(HELP_CONTEXT) */
  89. #define HELP_POPUPID        0x0104         /* not in SDK files */
  90. #endif /* defined(_NI_mswin_) */
  91.  
  92. #if defined(_NI_unix_) || defined(_NI_sparc_)
  93. #define CVI_STDIO_WINDOW    0
  94. #define HOST_SYSTEM_STDIO   1
  95. #endif
  96.  
  97. /* for the GetWindowDisplaySetting zoomState argument */
  98. #define VAL_NO_ZOOM         0L
  99. #define VAL_MINIMIZE            1L
  100. #define VAL_MAXIMIZE            2L
  101.  
  102.  
  103. /* for the GetCurrentPlatform() function */
  104. enum _GetCurrentPlatformEnum
  105. {
  106.     kPlatformWin16 = 1,
  107.     kPlatformWin95,
  108.     kPlatformWinnt,
  109.     kPlatformSunos4,
  110.     kPlatformSunos5,
  111.     kPlatformHPUX9,
  112.     kPlatformHPUX10,  
  113.     kPlatformMac      
  114. };
  115.  
  116.  
  117. /* for the CheckForDuplicateAppInstance() function */
  118. #define ACTIVATE_OTHER_INSTANCE         1 
  119. #define DO_NOT_ACTIVATE_OTHER_INSTANCE  0
  120.  
  121.  
  122. #if defined(_NI_mswin_) || defined(_NI_mswin16_) || defined(_NI_mswin32_)
  123. int CVIFUNC    GetDrive (int *currentDriveNum, int *numDrives);
  124. int CVIFUNC    GetFileAttrs (const char fileName[], int *readOnly, int *system,
  125.                              int *hidden, int *archive);
  126. void CVIFUNC   DisableTaskSwitching (void);
  127. void CVIFUNC   EnableTaskSwitching (void);
  128. int CVIFUNC    GetInterruptState (void);
  129. #ifdef _NI_mswin32_
  130. int CVIFUNC    GetModuleDir (void *hInstance, char dirName[]);
  131. #endif
  132. void CVIFUNC   GetWindowDisplaySetting (int *visible, int *zoomState);
  133.  
  134. int CVIFUNC    CheckForDuplicateAppInstance(int options, int *thereWasAnotherInstance);
  135.  
  136. #ifdef _NI_mswin32_
  137. int CVIFUNC    cviprefix(GetSystemTime) (int *hours, int *minutes, int *seconds);
  138. char CVIFUNC   cviprefix(inp) (short port);
  139. short CVIFUNC  cviprefix(inpw) (short port);
  140. char CVIFUNC   cviprefix(outp) (short port, char value);
  141. short CVIFUNC  cviprefix(outpw) (short port, short value);
  142. #define GetSystemTime cviprefix(GetSystemTime)
  143. #define inp     cviprefix(inp)
  144. #define inpw    cviprefix(inpw)
  145. #define outp    cviprefix(outp)
  146. #define outpw   cviprefix(outpw)
  147. #else
  148. int CVIFUNC    GetSystemTime (int *hours, int *minutes, int *seconds);
  149. char CVIFUNC   inp (short port);
  150. short CVIFUNC  inpw (short port);
  151. char CVIFUNC   outp (short port, char value);
  152. short CVIFUNC  outpw (short port, short value);
  153. #endif
  154. int CVIFUNC    GetSystemDate (int *month, int *day, int *year);
  155. int CVIFUNC    SetDrive (int driveNum);
  156. int CVIFUNC    SetFileAttrs (const char fileName[], int readOnly, int system,
  157.              int hidden, int archive);
  158.  
  159. #ifdef _NI_mswin32_
  160. int CVIFUNC    cviprefix(SetSystemTime) (int hours, int minutes, int seconds);
  161. #define SetSystemTime cviprefix(SetSystemTime)
  162. #else
  163. int CVIFUNC    SetSystemTime (int hours, int minutes, int seconds);
  164. #endif 
  165. int CVIFUNC    SetSystemDate (int month, int day, int year);
  166. int CVIFUNC    SystemHelp (const char *helpFileName, unsigned command, unsigned long longData, const char *stringData);
  167. int CVIFUNC    ReadFromPhysicalMemory (unsigned physicalAddr, void *buffer, unsigned size);
  168. int CVIFUNC    WriteToPhysicalMemory (unsigned physicalAddr, void *buffer, unsigned size);
  169. int CVIFUNC    ReadFromPhysicalMemoryEx (unsigned physicalAddr, void *buffer, unsigned size, int unitSize);
  170. int CVIFUNC    WriteToPhysicalMemoryEx (unsigned physicalAddr, void *buffer, unsigned size, int unitSize);
  171. int CVIFUNC    CVILowLevelSupportDriverLoaded(void);
  172. #endif  /* defined(_NI_mswin_) */
  173.  
  174. #if defined(_NI_unix_) || defined(_NI_sparc_)
  175. int CVIFUNC    SetStdioPort (int stdioPort);
  176. void CVIFUNC   GetStdioPort (int *stdioPort);
  177. #endif
  178.  
  179. #ifdef _NI_mswin32_
  180. void CVIFUNC   cviprefix(Beep) (void);
  181. #define Beep cviprefix(Beep)
  182. #else
  183. void CVIFUNC   Beep (void);
  184. #endif
  185.  
  186. void CVIFUNC   Breakpoint (void);
  187. void CVIFUNC   Cls (void);
  188.  
  189. #ifdef _NI_mswin32_
  190. int CVIFUNC    cviprefix(CopyFile) (const char sourceFile[], const char targetFile[]);
  191. #ifdef CopyFile
  192. #undef CopyFile
  193. #endif
  194. #define CopyFile cviprefix(CopyFile)
  195. #else
  196. int CVIFUNC    CopyFile (const char sourceFile[], const char targetFile[]);
  197. #endif
  198.  
  199. char * CVIFUNC DateStr (void);
  200. void CVIFUNC   Delay (double numSeconds);
  201. int CVIFUNC    DeleteDir (const char dirName[]);
  202.  
  203. #ifdef _NI_mswin32_
  204. int CVIFUNC    cviprefix(DeleteFile) (const char fileName[]);
  205. #ifdef DeleteFile
  206. #undef DeleteFile
  207. #endif
  208. #define DeleteFile cviprefix(DeleteFile)
  209. #else
  210. int CVIFUNC    DeleteFile (const char fileName[]);
  211. #endif
  212.  
  213. void CVIFUNC   DisableBreakOnLibraryErrors (void);
  214. void CVIFUNC   DisableInterrupts (void);
  215. void CVIFUNC   EnableBreakOnLibraryErrors (void);
  216. void CVIFUNC   EnableInterrupts (void);
  217. int CVIFUNC    ExecutableHasTerminated (int handle);
  218. int CVIFUNC    GetBreakOnLibraryErrors (void);
  219. int CVIFUNC    GetBreakOnProtectionErrors (void);
  220. int CVIFUNC    GetCVIVersion (void);
  221. int CVIFUNC    GetCurrentPlatform (void);
  222. int CVIFUNC    GetDir (char currentDir[]);
  223. int CVIFUNC    GetKey (void);
  224. int CVIFUNC    GetPersistentVariable (void);
  225. int CVIFUNC    GetProjectDir (char dirName[]);
  226. int CVIFUNC    GetFullPathFromProject (const char fileName[], char fullPathName[]);
  227. void * CVIFUNC GetExternalModuleAddr (int moduleId, const char symbolName[], int *status);
  228. int CVIFUNC    GetFileDate (const char fileName[], int *month, int *day, int *year);
  229.  
  230. #ifdef _NI_mswin32_
  231. int CVIFUNC    cviprefix(GetFileSize) (const char fileName[], long *fileSize);
  232. int CVIFUNC    cviprefix(GetFileTime) (const char fileName[], int *hours, int *minutes, int *seconds);
  233. #define GetFileSize cviprefix(GetFileSize)
  234. #define GetFileTime cviprefix(GetFileTime)
  235. #else
  236. int CVIFUNC    GetFileSize (const char fileName[], long *fileSize);
  237. int CVIFUNC    GetFileTime (const char fileName[], int *hours, int *minutes, int *seconds);
  238. #endif
  239. int CVIFUNC    GetFirstFile (const char searchPath[], int normal, int readOnly, int system,
  240.             int hidden, int archive, int directory, char fileName[]);
  241. int CVIFUNC    GetNextFile (char fileName[]);
  242. void CVIFUNC   GetStdioWindowOptions  (int *maxNumLines, int *bringToFrontWhenModified,
  243.                   int *showLineNumbers);
  244. void CVIFUNC   GetStdioWindowPosition  (int *top, int *left);
  245. void CVIFUNC   GetStdioWindowSize  (int *height, int *width);
  246. void CVIFUNC   GetStdioWindowVisibility  (int *visible);
  247. int CVIFUNC    InStandaloneExecutable  (void);
  248. int CVIFUNC    KeyHit (void);
  249. int CVIFUNC    LoadExternalModule (const char pathName[]);
  250. int CVIFUNC    LoadExternalModuleEx (const char pathName[], void *hInstance);
  251. int CVIFUNC    LaunchExecutable (const char fileName[]);
  252. int CVIFUNC    LaunchExecutableEx (const char fileName[], int nCmdShow, int *handle);
  253. int CVIFUNC    MakeDir (const char newDirName[]);
  254. int CVIFUNC    MakePathname (const char dirName[], const char fileName[], char pathName[]);
  255. int CVIFUNC    ReleaseExternalModule(int moduleId);
  256. int CVIFUNC    RenameFile (const char existingName[], const char newName[]);
  257. int CVIFUNC    RetireExecutableHandle (int handle);
  258. long CVIFUNC   RoundRealToNearestInteger (double x);
  259. int CVIFUNC    RunExternalModule (int moduleId, const char buffer[]);
  260. void CVIFUNC   SplitPath (const char pathName[], char driveName[], char dirName[], char fileName[]);
  261. int CVIFUNC    SetBreakOnLibraryErrors (int doBreak);
  262. int CVIFUNC    SetBreakOnProtectionErrors (int doBreak);
  263. int CVIFUNC    SetDir (const char dirName[]);
  264. int CVIFUNC    SetFileDate (const char fileName[], int month, int day, int year);
  265.  
  266. #ifdef _NI_mswin32_
  267. int CVIFUNC    cviprefix(SetFileTime) (const char fileName[], int hours, int minutes, int seconds);
  268. #define SetFileTime cviprefix(SetFileTime)
  269. #else
  270. int CVIFUNC    SetFileTime (const char fileName[], int hours, int minutes, int seconds);
  271. #endif
  272. void CVIFUNC   SetPersistentVariable (int value);
  273. int CVIFUNC    SetStdioWindowOptions (int maxNumLines, int bringToFrontWhenModified,
  274.                   int showLineNumbers);
  275. int CVIFUNC    SetStdioWindowPosition (int top, int left);
  276. int CVIFUNC    SetStdioWindowSize (int height, int width);
  277. void CVIFUNC   SetStdioWindowVisibility (int visible);
  278. void CVIFUNC   SyncWait (double beginTime, double interval);
  279. int CVIFUNC    TerminateExecutable (int handle);
  280. char * CVIFUNC TimeStr (void);
  281. int CVIFUNC    UnloadExternalModule (int moduleId);
  282.  
  283. double CVIFUNC Timer (void);
  284. double CVIFUNC TruncateRealNumber (double x);
  285.  
  286. extern void *__CVIUserHInst;
  287.  
  288. #ifdef __cplusplus
  289.     }
  290. #endif
  291.  
  292. #endif /* UTILITY_HEADER */
  293.  
  294.