home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 March / CMCD0304.ISO / Software / Freeware / Programare / nullsoft / nsis20.exe / Contrib / Math / Source / Math.h < prev    next >
C/C++ Source or Header  |  2003-09-15  |  2KB  |  88 lines

  1. #pragma once
  2.  
  3. #ifdef _DEBUG
  4. //#define _DEBUG_LEAKS
  5. #endif
  6.  
  7. #ifdef _DEBUG_LEAKS
  8.  
  9. #define dbgGlobalAlloc(a, b) watchGlobalAlloc(a, b)
  10. #define dbgGlobalFree(a) watchGlobalFree(a)
  11. #define dbgGlobalCheck() watchGlobal();
  12. void watchGlobal();
  13. void watchGlobalFree(HGLOBAL block);
  14. HGLOBAL watchGlobalAlloc(UINT Flags, UINT size);
  15.  
  16. #else
  17.  
  18. #define dbgGlobalAlloc(a, b) GlobalAlloc(a, b)
  19. #define dbgGlobalFree(a) GlobalFree(a)
  20. #define dbgGlobalCheck() {};
  21.  
  22. #endif
  23.  
  24.  
  25.  
  26. // only include this file from one place in your DLL.
  27. // (it is all static, if you use it in two places it will fail)
  28.  
  29. #define Math_INIT()           {  \
  30.         g_stringsize=string_size; \
  31.         g_stacktop=stacktop;      \
  32.         g_variables=variables; }
  33.  
  34. // For page showing plug-ins
  35. #define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
  36. #define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
  37. #define NOTIFY_BYE_BYE 'x'
  38.  
  39. typedef struct _stack_t {
  40.   struct _stack_t *next;
  41.   char text[1]; // this should be the length of string_size
  42. } stack_t;
  43.  
  44. extern unsigned int g_stringsize;
  45. extern stack_t **g_stacktop;
  46. extern char *g_variables;
  47.  
  48. enum
  49. {
  50. INST_0,         // $0
  51. INST_1,         // $1
  52. INST_2,         // $2
  53. INST_3,         // $3
  54. INST_4,         // $4
  55. INST_5,         // $5
  56. INST_6,         // $6
  57. INST_7,         // $7
  58. INST_8,         // $8
  59. INST_9,         // $9
  60. INST_R0,        // $R0
  61. INST_R1,        // $R1
  62. INST_R2,        // $R2
  63. INST_R3,        // $R3
  64. INST_R4,        // $R4
  65. INST_R5,        // $R5
  66. INST_R6,        // $R6
  67. INST_R7,        // $R7
  68. INST_R8,        // $R8
  69. INST_R9,        // $R9
  70. INST_CMDLINE,   // $CMDLINE
  71. INST_INSTDIR,   // $INSTDIR
  72. INST_OUTDIR,    // $OUTDIR
  73. INST_EXEDIR,    // $EXEDIR
  74. INST_LANG,      // $LANGUAGE
  75. __INST_LAST
  76. };
  77.  
  78.  
  79. // utility functions (not required but often useful)
  80. int popstring(char *str);
  81. void pushstring(char *str);
  82. char *getuservariable(int varnum);
  83. void setuservariable(int varnum, char *var);
  84. char *AllocString();
  85. ExpressionItem *AllocItem();
  86. ExpressionItem *AllocArray(int size);
  87. ExpressionItem *CopyItem(ExpressionItem *item, int NeedConst = 0);
  88.