home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 15 / AACD15.ISO / AACD / Magazine / HomeAutomation / Apache / include / php / main / php_ini.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-03  |  7.5 KB  |  159 lines

  1. /*
  2.    +----------------------------------------------------------------------+
  3.    | PHP version 4.0                                                      |
  4.    +----------------------------------------------------------------------+
  5.    | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group                   |
  6.    +----------------------------------------------------------------------+
  7.    | This source file is subject to version 2.02 of the PHP license,      |
  8.    | that is bundled with this package in the file LICENSE, and is        |
  9.    | available at through the world-wide-web at                           |
  10.    | http://www.php.net/license/2_02.txt.                                 |
  11.    | If you did not receive a copy of the PHP license and are unable to   |
  12.    | obtain it through the world-wide-web, please send a note to          |
  13.    | license@php.net so we can mail you a copy immediately.               |
  14.    +----------------------------------------------------------------------+
  15.    | Authors: Zeev Suraski <zeev@zend.com>                                |
  16.    +----------------------------------------------------------------------+
  17. */
  18.  
  19. #ifndef _PHP_INI_H
  20. #define _PHP_INI_H
  21.  
  22. #define PHP_INI_USER    (1<<0)
  23. #define PHP_INI_PERDIR    (1<<1)
  24. #define PHP_INI_SYSTEM    (1<<2)
  25.  
  26. #define PHP_INI_ALL (PHP_INI_USER|PHP_INI_PERDIR|PHP_INI_SYSTEM)
  27.  
  28. typedef struct _php_ini_entry php_ini_entry;
  29.  
  30. #define PHP_INI_MH(name) int name(php_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg1, void *mh_arg2, void *mh_arg3, int stage)
  31. #define PHP_INI_DISP(name) void name(php_ini_entry *ini_entry, int type)
  32.  
  33. struct _php_ini_entry {
  34.     int module_number;
  35.     int modifyable;
  36.     char *name;
  37.     uint name_length;
  38.     PHP_INI_MH((*on_modify));
  39.     void *mh_arg1;
  40.     void *mh_arg2;
  41.     void *mh_arg3;
  42.  
  43.     char *value;
  44.     uint value_length;
  45.  
  46.     char *orig_value;
  47.     uint orig_value_length;
  48.     int modified;
  49.  
  50.     void (*displayer)(php_ini_entry *ini_entry, int type);
  51. };
  52.  
  53.  
  54. int php_ini_mstartup(void);
  55. int php_ini_mshutdown(void);
  56. int php_ini_rshutdown(void);
  57.  
  58. void php_ini_sort_entries();
  59.  
  60. PHPAPI int php_register_ini_entries(php_ini_entry *ini_entry, int module_number);
  61. PHPAPI void php_unregister_ini_entries(int module_number);
  62. PHPAPI void php_ini_refresh_caches(int stage);
  63. PHPAPI int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type, int stage);
  64. PHPAPI int php_restore_ini_entry(char *name, uint name_length, int stage);
  65. PHPAPI void display_ini_entries(zend_module_entry *module);
  66.  
  67. PHPAPI long php_ini_long(char *name, uint name_length, int orig);
  68. PHPAPI double php_ini_double(char *name, uint name_length, int orig);
  69. PHPAPI char *php_ini_string(char *name, uint name_length, int orig);
  70. php_ini_entry *get_ini_entry(char *name, uint name_length);
  71.  
  72. PHPAPI int php_ini_register_displayer(char *name, uint name_length, void (*displayer)(php_ini_entry *ini_entry, int type));
  73. PHPAPI PHP_INI_DISP(php_ini_boolean_displayer_cb);
  74. PHPAPI PHP_INI_DISP(php_ini_color_displayer_cb);
  75. PHPAPI PHP_INI_DISP(display_link_numbers);
  76.  
  77. #define PHP_INI_BEGIN()        static php_ini_entry ini_entries[] = {
  78. #define PHP_INI_END()        { 0, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, NULL } };
  79.  
  80. #define PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, displayer) \
  81.     { 0, modifyable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, displayer },
  82.  
  83. #define PHP_INI_ENTRY3(name, default_value, modifyable, on_modify, arg1, arg2, arg3) \
  84.     PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, arg3, NULL)
  85.  
  86. #define PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, displayer) \
  87.     PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL, displayer)
  88.  
  89. #define PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, arg1, arg2) \
  90.     PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, arg1, arg2, NULL)
  91.  
  92. #define PHP_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, displayer) \
  93.     PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, arg1, NULL, NULL, displayer)
  94.  
  95. #define PHP_INI_ENTRY1(name, default_value, modifyable, on_modify, arg1) \
  96.     PHP_INI_ENTRY1_EX(name, default_value, modifyable, on_modify, arg1, NULL)
  97.     
  98. #define PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, displayer) \
  99.     PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, NULL, NULL, NULL, displayer)
  100.  
  101. #define PHP_INI_ENTRY(name, default_value, modifyable, on_modify) \
  102.     PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, NULL)
  103.  
  104. #ifdef ZTS
  105. #define STD_PHP_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
  106.     PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id)
  107. #define STD_PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \
  108.     PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, displayer)
  109. #define STD_PHP_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
  110.     PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr##_id, NULL, php_ini_boolean_displayer_cb)
  111. #else
  112. #define STD_PHP_INI_ENTRY(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
  113.     PHP_INI_ENTRY2(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr)
  114. #define STD_PHP_INI_ENTRY_EX(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr, displayer) \
  115.     PHP_INI_ENTRY2_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, displayer)
  116. #define STD_PHP_INI_BOOLEAN(name, default_value, modifyable, on_modify, property_name, struct_type, struct_ptr) \
  117.     PHP_INI_ENTRY3_EX(name, default_value, modifyable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr, NULL, php_ini_boolean_displayer_cb)
  118. #endif
  119.  
  120. #define INI_INT(name) php_ini_long((name), sizeof(name), 0)
  121. #define INI_FLT(name) php_ini_double((name), sizeof(name), 0)
  122. #define INI_STR(name) php_ini_string((name), sizeof(name), 0)
  123. #define INI_BOOL(name) ((zend_bool) INI_INT(name))
  124.  
  125. #define INI_ORIG_INT(name)    php_ini_long((name), sizeof(name), 1)
  126. #define INI_ORIG_FLT(name)    php_ini_double((name), sizeof(name), 1)
  127. #define INI_ORIG_STR(name)    php_ini_string((name), sizeof(name), 1)
  128. #define INI_ORIG_BOOL(name) ((zend_bool) INI_ORIG_INT(name))
  129.  
  130.  
  131. #define REGISTER_INI_ENTRIES() php_register_ini_entries(ini_entries, module_number)
  132. #define UNREGISTER_INI_ENTRIES() php_unregister_ini_entries(module_number)
  133. #define DISPLAY_INI_ENTRIES() display_ini_entries(zend_module)
  134.  
  135. #define REGISTER_INI_DISPLAYER(name, displayer) php_ini_register_displayer((name), sizeof(name), displayer)
  136. #define REGISTER_INI_BOOLEAN(name) REGISTER_INI_DISPLAYER(name, php_ini_boolean_displayer_cb)
  137.  
  138. pval *cfg_get_entry(char *name, uint name_length);
  139.  
  140.  
  141. /* Standard message handlers */
  142. PHPAPI PHP_INI_MH(OnUpdateBool);
  143. PHPAPI PHP_INI_MH(OnUpdateInt);
  144. PHPAPI PHP_INI_MH(OnUpdateReal);
  145. PHPAPI PHP_INI_MH(OnUpdateString);
  146. PHPAPI PHP_INI_MH(OnUpdateStringUnempty);
  147.  
  148.  
  149. #define PHP_INI_DISPLAY_ORIG    1
  150. #define PHP_INI_DISPLAY_ACTIVE    2
  151.  
  152. #define PHP_INI_STAGE_STARTUP        (1<<0)
  153. #define PHP_INI_STAGE_SHUTDOWN        (1<<1)
  154. #define PHP_INI_STAGE_ACTIVATE        (1<<2)
  155. #define PHP_INI_STAGE_DEACTIVATE    (1<<3)
  156. #define PHP_INI_STAGE_RUNTIME        (1<<4)
  157.  
  158. #endif /* _PHP_INI_H */
  159.