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.

98 lines
2.4 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Turbo Vision - Version 2.0
  3. *
  4. * Copyright (c) 1994 by Borland International
  5. * All Rights Reserved.
  6. *
  7. Modified by Robert H�hne to be used for RHIDE.
  8. Modified by Salvador E. Tropea to avoid macros collisions and make easier to use.
  9. */
  10. #if !defined( __UTIL_H )
  11. #define __UTIL_H
  12. // SET: Used by names, they only include this file.
  13. #ifdef Uses_n
  14. #include <compatlayer.h>
  15. #endif
  16. #undef __CM
  17. #undef __HC
  18. #undef __BASE
  19. #define __BASE 128
  20. #define __CM(x,y) const unsigned short cm##x = __BASE+y;
  21. #define __HC(x,y) const unsigned short hc##x = __BASE+y;
  22. #ifndef CLY_DONT_DEFINE_MIN_MAX
  23. #ifdef min
  24. #undef min
  25. #endif
  26. #ifdef max
  27. #undef max
  28. #endif
  29. inline int min( const int &a, const int &b )
  30. {
  31. return (a>b) ? b : a;
  32. }
  33. inline int max( const int &a, const int &b )
  34. {
  35. return (a<b) ? b : a;
  36. }
  37. // The following min/max works for any kind of data type
  38. // Published by Vincent Van Den Berghe in the Windows/DOS developer's journal April 93
  39. // But they don't replace the above functions for cases like:
  40. // max(int,unsigned int)
  41. //
  42. template <class T> inline T min( const T &a, const T &b )
  43. {
  44. return (a>b) ? b : a;
  45. }
  46. template <class T> inline T max( const T &a, const T &b )
  47. {
  48. return (a<b) ? b : a;
  49. }
  50. #endif
  51. char hotKey( const char *s );
  52. unsigned short ctrlToArrow( unsigned short );
  53. unsigned short historyCount( unsigned char id );
  54. const char *historyStr( unsigned char id, int index );
  55. void historyAdd( unsigned char id, const char * );
  56. int cstrlen( const char * );
  57. class TView;
  58. void *message( TView *receiver, unsigned short what, unsigned short command,
  59. void *infoPtr );
  60. Boolean lowMemory();
  61. char *newStr( const char * );
  62. /* SET: Added a conditional for it because n is too common. I remmember I had
  63. problems with it and Jerzy Witkowski <jwi@pl.ibm.com> complained about
  64. conflicts between a class member in your code and this macro */
  65. #ifdef Uses_n
  66. /* The following macro is a little hack to decrease the compile time
  67. for the TV lib when compiling all the n*.cc files */
  68. #define n(CLASS) \
  69. class CLASS \
  70. { \
  71. public: \
  72. static const char * const name; \
  73. }; \
  74. \
  75. const char * const CLASS::name = #CLASS;
  76. #endif
  77. #endif // __UTIL_H