Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
4.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1997
  6. //
  7. // File: basics.h
  8. //
  9. //--------------------------------------------------------------------------
  10. //
  11. // BASICS.H: Basic STL-based declarations
  12. //
  13. #ifndef _BASICS_H_
  14. #define _BASICS_H_
  15. // handle version differences
  16. #include "mscver.h"
  17. #include <tchar.h>
  18. // STL Inclusions
  19. #include <exception>
  20. #include <vector>
  21. USE_STD_NAMESPACE;
  22. // General common typedefs
  23. typedef TCHAR * TZC;
  24. typedef const TCHAR * TSZC;
  25. typedef const char * SZC;
  26. typedef char * SZ;
  27. typedef unsigned int UINT;
  28. typedef unsigned short USINT;
  29. typedef unsigned long ULONG;
  30. typedef long LONG;
  31. typedef int INT;
  32. typedef short SINT;
  33. typedef double REAL;
  34. typedef double DBL;
  35. typedef double PROB;
  36. typedef double COST;
  37. typedef double SSTAT;
  38. typedef double PARAM;
  39. typedef double MEAN;
  40. typedef double COV;
  41. typedef double LOGPROB;
  42. typedef UINT IDPI; // 2^n, last-fastest (I)ndex indicating a (D)iscrete
  43. // (P)arent (I)nstance
  44. // Define array indexing values and discrete state counting values identically
  45. typedef UINT IMD; // Index into a multidimensional array
  46. typedef UINT CST; // Count of states
  47. typedef UINT IST; // Index of a discrete state
  48. typedef INT SIMD; // Signed index into a multidimensonal array
  49. typedef float RST; // Real-valued state
  50. typedef UINT TOKEN; // Parser token
  51. typedef int BOOL; // Must remain int, because windows.h defines it also
  52. #ifndef VOID
  53. #define VOID void // MSRDEVBUG: Archaic usage
  54. #endif
  55. typedef char CHAR;
  56. // 'qsort' interface function prototypedef
  57. typedef INT (*PFNCMP)(const VOID*, const VOID*);
  58. #define CONSTANT static const // define a program-scoped constant
  59. // General constants
  60. CONSTANT INT INIL = INT_MAX; // Invalid signed integer
  61. CONSTANT UINT UINIL = INT_MAX; // Invalid unsigned integer (compatible with int)
  62. CONSTANT long INFINITY = 100000000; // A very large integer value
  63. CONSTANT REAL RTINY = 1.0e-20; // A number very close to zero (from Numerical Recipies)
  64. CONSTANT REAL RNEARLYONE = 1.0 - RTINY; // A number very close to one
  65. CONSTANT REAL RNA = -1.0; // "unassessed" value
  66. // Database constant values
  67. CONSTANT IST istMissing = 22223;
  68. CONSTANT IST istInvalid = IST(-1); // MSRDEVBUG: should be UINIL
  69. CONSTANT RST rstMissing = (RST) 22223.12345;
  70. CONSTANT RST rstInvalid = (RST) 22223.54321;
  71. // A useful alias in member functions
  72. #define self (*this)
  73. // Define common vector classes and macros to generalize declarations.
  74. typedef vector<bool> vbool; // Vector of 'bool': lower case to distinguish from BOOL (in windows.h)
  75. #define DEFINEV(T) typedef vector<T> V##T;
  76. #define DEFINEVP(T) typedef vector<T *> VP##T;
  77. #define DEFINEVCP(T) typedef vector<const T *> VCP##T;
  78. DEFINEV(UINT); // Define VUINT
  79. DEFINEV(VUINT);
  80. DEFINEV(INT); // Define VINT
  81. DEFINEV(USINT); // Define VUSINT
  82. DEFINEV(REAL); // Define VREAL
  83. DEFINEV(PROB);
  84. DEFINEV(VPROB);
  85. DEFINEV(DBL);
  86. DEFINEV(VDBL);
  87. DEFINEV(VVDBL);
  88. DEFINEV(SSTAT);
  89. DEFINEV(VSSTAT);
  90. DEFINEV(CST);
  91. DEFINEV(VCST);
  92. DEFINEV(IST);
  93. DEFINEV(VIST);
  94. DEFINEV(RST);
  95. DEFINEV(BOOL);
  96. DEFINEV(VBOOL);
  97. DEFINEV(PARAM);
  98. DEFINEV(SZ);
  99. DEFINEV(VSZ);
  100. DEFINEV(SZC);
  101. DEFINEV(VSZC);
  102. DEFINEV(MEAN);
  103. DEFINEV(COV);
  104. DEFINEV(IMD); // Define VIMD: vector of indicies into an m-d array
  105. DEFINEV(SIMD); // Define VSIMD: for an array of SIGNED dimensions
  106. // Macro to control hiding of unsafe elements
  107. #ifndef DONT_HIDE_ALL_UNSAFE
  108. #define HIDE_UNSAFE(T) \
  109. private: \
  110. T(const T &); \
  111. T & operator = (const T &);
  112. #define HIDE_AS(T) private: T & operator = (const T &);
  113. #define HIDE_CC(T) T(const T &);
  114. #else
  115. #define HIDE_UNSAFE(T)
  116. #endif
  117. // Macro to generate the ordering operators which must be declared
  118. // for use in arrays but which do not need to exist unless used.
  119. #define DECLARE_ORDERING_OPERATORS(T) \
  120. bool operator < ( const T & ) const; \
  121. bool operator > ( const T & ) const; \
  122. bool operator == ( const T & ) const; \
  123. bool operator != ( const T & ) const;
  124. //
  125. // UBOUND: macro to return the number of elements in a static array
  126. //
  127. #ifndef UBOUND
  128. #define UBOUND(rg) (sizeof rg/sizeof rg[0])
  129. #endif
  130. #include "gmexcept.h"
  131. #include "dyncast.h"
  132. #endif