Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

This commit was manufactured by cvs2svn to create tag 'RELEASE_1_0_2'.

  • Loading branch information...
commit 64ed05bf8ed66726a318df16b7933cc1c6eb5eb4 1 parent 985f1c2
SVN Migration authored

Showing 86 changed files with 13,267 additions and 2,684 deletions. Show diff stats Hide diff stats

  1. +2 0  ext/enchant/CREDITS
  2. +36 0 ext/enchant/config.m4
  3. +13 0 ext/enchant/config.w32
  4. +25 0 ext/enchant/docs/examples/example1.php
  5. +774 0 ext/enchant/enchant.c
  6. +146 0 ext/enchant/package.xml
  7. +83 0 ext/enchant/php_enchant.h
  8. +28 0 ext/enchant/tests/broker_describe.phpt
  9. +21 0 ext/enchant/tests/broker_free.phpt
  10. +15 0 ext/enchant/tests/broker_init.phpt
  11. +31 0 ext/enchant/tests/broker_request_dict.phpt
  12. +1 0  ext/enchant/tests/hindi_correct.txt
  13. +1 0  ext/enchant/tests/hindi_incorrect.txt
  14. +2 0  ext/fileinfo/CREDITS
  15. 0  ext/fileinfo/EXPERIMENTAL
  16. +62 0 ext/fileinfo/config.m4
  17. +437 0 ext/fileinfo/fileinfo.c
  18. +29 0 ext/fileinfo/fileinfo.php
  19. +43 0 ext/fileinfo/package.xml
  20. +61 0 ext/fileinfo/php_fileinfo.h
  21. +2 0  ext/pdo/CREDITS
  22. +26 0 ext/pdo/Makefile.frag
  23. +56 0 ext/pdo/README
  24. +97 0 ext/pdo/TODO
  25. +68 0 ext/pdo/config.m4
  26. +10 0 ext/pdo/config.w32
  27. +119 0 ext/pdo/package.xml
  28. +399 0 ext/pdo/pdo.c
  29. +62 0 ext/pdo/pdo.php
  30. +1,443 0 ext/pdo/pdo_dbh.c
  31. +712 0 ext/pdo/pdo_sql_parser.c
  32. +487 0 ext/pdo/pdo_sql_parser.re
  33. +340 0 ext/pdo/pdo_sqlstate.c
  34. +2,499 0 ext/pdo/pdo_stmt.c
  35. +91 0 ext/pdo/php_pdo.h
  36. +663 0 ext/pdo/php_pdo_driver.h
  37. +84 0 ext/pdo/php_pdo_int.h
  38. +3 0  ext/pdo_mysql/CREDITS
  39. +134 0 ext/pdo_mysql/config.m4
  40. +15 0 ext/pdo_mysql/config.w32
  41. +27 0 ext/pdo_mysql/get_error_codes.php
  42. +573 0 ext/pdo_mysql/mysql_driver.c
  43. +642 0 ext/pdo_mysql/mysql_statement.c
  44. +93 0 ext/pdo_mysql/package2.xml
  45. +116 0 ext/pdo_mysql/pdo_mysql.c
  46. +53 0 ext/pdo_mysql/php_pdo_mysql.h
  47. +90 0 ext/pdo_mysql/php_pdo_mysql_int.h
  48. +388 0 ext/pdo_mysql/php_pdo_mysql_sqlstate.h
  49. +50 0 ext/pdo_mysql/tests/bug_33689.phpt
  50. +28 0 ext/pdo_mysql/tests/common.phpt
  51. +19 0 ext/pdo_mysql/tests/config.inc
  52. +30 0 ext/pdo_mysql/tests/pecl_bug_5200.phpt
  53. +41 0 ext/pdo_mysql/tests/pecl_bug_5780.phpt
  54. +52 0 ext/pdo_mysql/tests/pecl_bug_5802.phpt
  55. +20 0 ext/pdo_mysql/tests/show_tables.phpt
  56. +2 0  ext/pdo_pgsql/CREDITS
  57. +131 0 ext/pdo_pgsql/config.m4
  58. +22 0 ext/pdo_pgsql/config.w32
  59. +87 0 ext/pdo_pgsql/package2.xml
  60. +139 0 ext/pdo_pgsql/pdo_pgsql.c
  61. +711 0 ext/pdo_pgsql/pgsql_driver.c
  62. +664 0 ext/pdo_pgsql/pgsql_statement.c
  63. +55 0 ext/pdo_pgsql/php_pdo_pgsql.h
  64. +114 0 ext/pdo_pgsql/php_pdo_pgsql_int.h
  65. +0 10 ext/sqlite/tests/bug26911.phpt
  66. +0 13 ext/sqlite/tests/sqlite_018.phpt
  67. +0 46 ext/sqlite/tests/sqlite_019.phpt
  68. +0 98 ext/sqlite/tests/sqlite_022.phpt
  69. +0 2  ext/tidy/CREDITS
  70. +0 122 ext/tidy/README
  71. +0 3  ext/tidy/TODO
  72. +0 35 ext/tidy/config.m4
  73. +0 38 ext/tidy/examples/cleanhtml.php
  74. +0 93 ext/tidy/examples/dumpit.php
  75. +0 60 ext/tidy/examples/urlgrab.php
  76. +0 64 ext/tidy/package.xml
  77. +0 238 ext/tidy/php_tidy.h
  78. +0 24 ext/tidy/tests/001.phpt
  79. +0 22 ext/tidy/tests/002.phpt
  80. +0 25 ext/tidy/tests/003.phpt
  81. +0 21 ext/tidy/tests/004.phpt
  82. +0 1  ext/tidy/tests/005.html
  83. +0 23 ext/tidy/tests/005.phpt
  84. +0 21 ext/tidy/tests/006.phpt
  85. +0 36 ext/tidy/tests/007.phpt
  86. +0 1,689 ext/tidy/tidy.c
2  ext/enchant/CREDITS
... ... @@ -0,0 +1,2 @@
  1 +enchant
  2 +Pierre-Alain Joye, Ilia Alshanetsky
36 ext/enchant/config.m4
... ... @@ -0,0 +1,36 @@
  1 +dnl
  2 +dnl $Id$
  3 +dnl
  4 +
  5 +PHP_ARG_WITH(enchant,for ENCHANT support,
  6 +[ --with-enchant[=DIR] Include enchant support.
  7 + GNU Aspell version 1.1.3 or higher required.])
  8 +
  9 +if test "$PHP_ENCHANT" != "no"; then
  10 + PHP_NEW_EXTENSION(enchant, enchant.c, $ext_shared)
  11 + if test "$PHP_ENCHANT" != "yes"; then
  12 + ENCHANT_SEARCH_DIRS=$PHP_ENCHANT
  13 + else
  14 + ENCHANT_SEARCH_DIRS="/usr/local /usr"
  15 + fi
  16 + for i in $ENCHANT_SEARCH_DIRS; do
  17 + if test -f $i/include/enchant/enchant.h; then
  18 + ENCHANT_DIR=$i
  19 + ENCHANT_INCDIR=$i/include/enchant
  20 + elif test -f $i/include/enchant.h; then
  21 + ENCHANT_DIR=$i
  22 + ENCHANT_INCDIR=$i/include
  23 + fi
  24 + done
  25 +
  26 + if test -z "$ENCHANT_DIR"; then
  27 + AC_MSG_ERROR(Cannot find enchant)
  28 + fi
  29 +
  30 + ENCHANT_LIBDIR=$ENCHANT_DIR/lib
  31 +
  32 + AC_DEFINE(HAVE_ENCHANT,1,[ ])
  33 + PHP_SUBST(ENCHANT_SHARED_LIBADD)
  34 + PHP_ADD_LIBRARY_WITH_PATH(enchant, $ENCHANT_LIBDIR, ENCHANT_SHARED_LIBADD)
  35 + PHP_ADD_INCLUDE($ENCHANT_INCDIR)
  36 +fi
13 ext/enchant/config.w32
... ... @@ -0,0 +1,13 @@
  1 +// $Id$
  2 +// vim:ft=javascript
  3 +
  4 +ARG_ENABLE("enchant", "Enchant Support", "no");
  5 +
  6 +if (PHP_ENCHANT == "yes") {
  7 + if (CHECK_HEADER_ADD_INCLUDE("enchant.h", "CFLAGS_ENCHANT", PHP_ENCHANT)) {
  8 + EXTENSION("enchant", "enchant.c");
  9 + AC_DEFINE('HAVE_ENCHANT', 1, 'Have Enchant support', false);
  10 + } else {
  11 + WARNING('Could not find enchant.h; skipping');
  12 + }
  13 +}
25 ext/enchant/docs/examples/example1.php
... ... @@ -0,0 +1,25 @@
  1 +<?php
  2 +$tag = 'en_US';
  3 +$r = enchant_broker_init();
  4 +$bprovides = enchant_broker_describe($r);
  5 +echo "Current broker provides the following backend(s):\n";
  6 +print_r($bprovides);
  7 +
  8 +
  9 +if (enchant_broker_dict_exists($r,$tag)) {
  10 + $d = enchant_broker_request_dict($r, $tag);
  11 + $dprovides = enchant_dict_describe($d);
  12 + echo "dictionary $tag provides:\n";
  13 + $spellerrors = enchant_dict_check($d, "soong");
  14 + print_r($dprovides);
  15 + echo "found $spellerrors spell errors\n";
  16 + if ($spellerrors) {
  17 + $suggs = enchant_dict_suggest($d, "soong");
  18 + echo "Suggestions for 'soong':";
  19 + print_r($suggs);
  20 + }
  21 + enchant_broker_free_dict($d);
  22 +} else {
  23 +}
  24 +enchant_broker_free($r);
  25 +?>
774 ext/enchant/enchant.c
... ... @@ -0,0 +1,774 @@
  1 +/*
  2 + +----------------------------------------------------------------------+
  3 + | PHP Version 5 |
  4 + +----------------------------------------------------------------------+
  5 + | Copyright (c) 1997-2004 The PHP Group |
  6 + +----------------------------------------------------------------------+
  7 + | This source file is subject to version 3.0 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/3_0.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 + | Author: Pierre-Alain Joye <paj@pearfr.org> |
  16 + | Ilia Alshanetsky <ilia@prohost.org> |
  17 + +----------------------------------------------------------------------+
  18 +
  19 + $Id$
  20 +*/
  21 +
  22 +#ifdef HAVE_CONFIG_H
  23 +#include "config.h"
  24 +#endif
  25 +#include <enchant.h>
  26 +#include "php.h"
  27 +#include "php_ini.h"
  28 +#include "ext/standard/info.h"
  29 +#include "php_enchant.h"
  30 +
  31 +
  32 +typedef EnchantBroker * EnchantBrokerPtr;
  33 +typedef struct _broker_struct enchant_broker;
  34 +typedef struct _dict_struct enchant_dict;
  35 +
  36 +typedef enchant_broker * enchant_brokerPtr;
  37 +typedef enchant_dict * enchant_dictPtr;
  38 +
  39 +typedef struct _broker_struct {
  40 + EnchantBroker *pbroker;
  41 + enchant_dict **dict;
  42 + unsigned int dictcnt;
  43 + long rsrc_id;
  44 +} _enchant_broker;
  45 +
  46 +typedef struct _dict_struct {
  47 + unsigned int id;
  48 + EnchantDict *pdict;
  49 + enchant_broker *pbroker;
  50 + long rsrc_id;
  51 + enchant_dict *next;
  52 + enchant_dict *prev;
  53 +} _enchant_dict;
  54 +
  55 +
  56 +/* True global resources - no need for thread safety here */
  57 +static int le_enchant_broker;
  58 +static int le_enchant_dict;
  59 +
  60 +/* If you declare any globals in php_enchant.h uncomment this:*/
  61 +/*ZEND_DECLARE_MODULE_GLOBALS(enchant)*/
  62 +
  63 +/* {{{ enchant_functions[]
  64 + *
  65 + * Every user visible function must have an entry in enchant_functions[].
  66 + */
  67 +function_entry enchant_functions[] = {
  68 + PHP_FE(enchant_broker_init, NULL)
  69 + PHP_FE(enchant_broker_free, NULL)
  70 + PHP_FE(enchant_broker_get_error, NULL)
  71 + PHP_FE(enchant_broker_list_dicts, NULL)
  72 + PHP_FE(enchant_broker_request_dict, NULL)
  73 + PHP_FE(enchant_broker_request_pwl_dict, NULL)
  74 + PHP_FE(enchant_broker_free_dict, NULL)
  75 + PHP_FE(enchant_broker_dict_exists, NULL)
  76 + PHP_FE(enchant_broker_set_ordering, NULL)
  77 + PHP_FE(enchant_broker_describe, NULL)
  78 + PHP_FE(enchant_dict_check, NULL)
  79 + PHP_FE(enchant_dict_suggest, NULL)
  80 + PHP_FE(enchant_dict_add_to_personal, NULL)
  81 + PHP_FE(enchant_dict_add_to_session, NULL)
  82 + PHP_FE(enchant_dict_is_in_session, NULL)
  83 + PHP_FE(enchant_dict_store_replacement, NULL)
  84 + PHP_FE(enchant_dict_get_error, NULL)
  85 + PHP_FE(enchant_dict_describe, NULL)
  86 + PHP_FE(enchant_dict_quick_check, third_arg_force_ref)
  87 +
  88 + {NULL, NULL, NULL} /* Must be the last line in enchant_functions[] */
  89 +};
  90 +/* }}} */
  91 +
  92 +/* {{{ enchant_module_entry
  93 + */
  94 +zend_module_entry enchant_module_entry = {
  95 +#if ZEND_MODULE_API_NO >= 20010901
  96 + STANDARD_MODULE_HEADER,
  97 +#endif
  98 + "enchant",
  99 + enchant_functions,
  100 + PHP_MINIT(enchant),
  101 + PHP_MSHUTDOWN(enchant),
  102 + NULL, /* Replace with NULL if there's nothing to do at request start */
  103 + NULL, /* Replace with NULL if there's nothing to do at request end */
  104 + PHP_MINFO(enchant),
  105 +#if ZEND_MODULE_API_NO >= 20010901
  106 + PHP_ENCHANT_VERSION,
  107 +#endif
  108 + STANDARD_MODULE_PROPERTIES
  109 +};
  110 +/* }}} */
  111 +
  112 +#ifdef COMPILE_DL_ENCHANT
  113 +ZEND_GET_MODULE(enchant)
  114 +#endif
  115 +
  116 +static void
  117 +enumerate_providers_fn (const char * const name,
  118 + const char * const desc,
  119 + const char * const file,
  120 + void * ud) /* {{{ */
  121 +{
  122 + zval *zdesc = (zval *) ud;
  123 + zval *tmp_array;
  124 +
  125 + MAKE_STD_ZVAL(tmp_array);
  126 + array_init(tmp_array);
  127 +
  128 + add_assoc_string(tmp_array, "name", (char *)name, 1);
  129 + add_assoc_string(tmp_array, "desc", (char *)desc, 1);
  130 + add_assoc_string(tmp_array, "file", (char *)file, 1);
  131 +
  132 + if (Z_TYPE_P(zdesc)!=IS_ARRAY) {
  133 + array_init(zdesc);
  134 + }
  135 +
  136 + add_next_index_zval(zdesc, tmp_array);
  137 +}
  138 +/* }}} */
  139 +
  140 +static void
  141 +describe_dict_fn (const char * const lang,
  142 + const char * const name,
  143 + const char * const desc,
  144 + const char * const file,
  145 + void * ud) /* {{{ */
  146 +{
  147 + zval *zdesc = (zval *) ud;
  148 + array_init(zdesc);
  149 + add_assoc_string(zdesc, "lang", (char *)lang, 1);
  150 + add_assoc_string(zdesc, "name", (char *)name, 1);
  151 + add_assoc_string(zdesc, "desc", (char *)desc, 1);
  152 + add_assoc_string(zdesc, "file", (char *)file, 1);
  153 +}
  154 +/* }}} */
  155 +
  156 +static void php_enchant_list_dicts_fn( const char * const lang_tag,
  157 + const char * const provider_name, const char * const provider_desc,
  158 + const char * const provider_file, void * ud) /* {{{ */
  159 +{
  160 + zval *zdesc = (zval *) ud;
  161 + zval *tmp_array;
  162 +
  163 + MAKE_STD_ZVAL(tmp_array);
  164 + array_init(tmp_array);
  165 + add_assoc_string(tmp_array, "lang_tag", (char *)lang_tag, 1);
  166 + add_assoc_string(tmp_array, "provider_name", (char *)provider_name, 1);
  167 + add_assoc_string(tmp_array, "provider_desc", (char *)provider_desc, 1);
  168 + add_assoc_string(tmp_array, "provider_file", (char *)provider_file, 1);
  169 +
  170 + if (Z_TYPE_P(zdesc) != IS_ARRAY) {
  171 + array_init(zdesc);
  172 + }
  173 + add_next_index_zval(zdesc, tmp_array);
  174 +
  175 +}
  176 +/* }}} */
  177 +
  178 +static void php_enchant_broker_free(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
  179 +{
  180 + if (rsrc->ptr) {
  181 + enchant_broker *broker = (enchant_broker *)rsrc->ptr;
  182 + if (broker) {
  183 + if (broker->pbroker) {
  184 + if (broker->dictcnt && broker->dict) {
  185 + if (broker->dict) {
  186 + int total, tofree;
  187 + tofree = total = broker->dictcnt-1;
  188 + do {
  189 + zend_list_delete(broker->dict[total]->rsrc_id);
  190 + efree(broker->dict[total]);
  191 + total--;
  192 + } while (total>=0);
  193 + }
  194 + efree(broker->dict);
  195 + broker->dict = NULL;
  196 + }
  197 + enchant_broker_free(broker->pbroker);
  198 + }
  199 + efree(broker);
  200 + }
  201 + }
  202 +}
  203 +/* }}} */
  204 +
  205 +static void php_enchant_dict_free(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
  206 +
  207 +{
  208 + if (rsrc->ptr) {
  209 + enchant_dict *pdict = (enchant_dict *)rsrc->ptr;
  210 + if (pdict) {
  211 + if (pdict->pdict && pdict->pbroker) {
  212 + enchant_broker_free_dict(pdict->pbroker->pbroker, pdict->pdict);
  213 + if (pdict->id) {
  214 + pdict->pbroker->dict[pdict->id-1]->next = NULL;
  215 + }
  216 + zend_list_delete(pdict->pbroker->rsrc_id);
  217 + }
  218 +
  219 + }
  220 + }
  221 +}
  222 +/* }}} */
  223 +
  224 +/* {{{ PHP_MINIT_FUNCTION
  225 + */
  226 +PHP_MINIT_FUNCTION(enchant)
  227 +{
  228 + le_enchant_broker = zend_register_list_destructors_ex(php_enchant_broker_free, NULL, "enchant_broker", module_number);
  229 + le_enchant_dict = zend_register_list_destructors_ex(php_enchant_dict_free, NULL, "enchant_dict", module_number);
  230 +
  231 + return SUCCESS;
  232 +}
  233 +/* }}} */
  234 +
  235 +/* {{{ PHP_MSHUTDOWN_FUNCTION
  236 + */
  237 +PHP_MSHUTDOWN_FUNCTION(enchant)
  238 +{
  239 + return SUCCESS;
  240 +}
  241 +/* }}} */
  242 +
  243 +static void __enumerate_providers_fn (const char * const name,
  244 + const char * const desc,
  245 + const char * const file,
  246 + void * ud) /* {{{ */
  247 +{
  248 + php_info_print_table_row(3, name, desc, file);
  249 +}
  250 +/* }}} */
  251 +
  252 +/* {{{ PHP_MINFO_FUNCTION
  253 + */
  254 +PHP_MINFO_FUNCTION(enchant)
  255 +{
  256 + EnchantBroker *pbroker;
  257 +
  258 + pbroker = enchant_broker_init();
  259 + php_info_print_table_start();
  260 + php_info_print_table_header(2, "enchant support", "enabled");
  261 + php_info_print_table_row(2, "Version", PHP_ENCHANT_VERSION);
  262 + php_info_print_table_row(2, "Revision", "$Revision$");
  263 + php_info_print_table_end();
  264 +
  265 + php_info_print_table_start();
  266 + enchant_broker_describe(pbroker, __enumerate_providers_fn, NULL);
  267 + php_info_print_table_end();
  268 + enchant_broker_free(pbroker);
  269 +}
  270 +/* }}} */
  271 +
  272 +#define PHP_ENCHANT_GET_BROKER \
  273 + ZEND_FETCH_RESOURCE(pbroker, enchant_broker *, &broker, -1, "enchant_broker", le_enchant_broker); \
  274 + if (!pbroker || !pbroker->pbroker) { \
  275 + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "Resource broker invalid"); \
  276 + RETURN_FALSE; \
  277 + }
  278 +
  279 +#define PHP_ENCHANT_GET_DICT \
  280 + ZEND_FETCH_RESOURCE(pdict, enchant_dict *, &dict, -1, "enchant_dict", le_enchant_dict); \
  281 + if (!pdict || !pdict->pdict) { \
  282 + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", "Invalid dictionary resource."); \
  283 + RETURN_FALSE; \
  284 + }
  285 +
  286 +/* {{{ proto resource enchant_broker_init()
  287 + create a new broker object capable of requesting */
  288 +PHP_FUNCTION(enchant_broker_init)
  289 +{
  290 + enchant_broker *broker;
  291 + EnchantBroker *pbroker;
  292 +
  293 + if (ZEND_NUM_ARGS()) {
  294 + ZEND_WRONG_PARAM_COUNT();
  295 + }
  296 +
  297 + pbroker = enchant_broker_init();
  298 +
  299 + if (pbroker) {
  300 + broker = (enchant_broker *) emalloc(sizeof(enchant_broker));
  301 + broker->pbroker = pbroker;
  302 + broker->dict = NULL;
  303 + broker->dictcnt = 0;
  304 + broker->rsrc_id = ZEND_REGISTER_RESOURCE(return_value, broker, le_enchant_broker);
  305 + } else {
  306 + RETURN_FALSE;
  307 + }
  308 +}
  309 +/* }}} */
  310 +
  311 +/* {{{ proto boolean enchant_broker_free(resource broker)
  312 + Destroys the broker object and its dictionnaries */
  313 +PHP_FUNCTION(enchant_broker_free)
  314 +{
  315 + zval *broker;
  316 + enchant_broker *pbroker;
  317 +
  318 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
  319 + RETURN_FALSE;
  320 + }
  321 + PHP_ENCHANT_GET_BROKER;
  322 +
  323 + zend_list_delete(Z_RESVAL_P(broker));
  324 + RETURN_TRUE;
  325 +}
  326 +/* }}} */
  327 +
  328 +/* {{{ proto string enchant_broker_get_error(resource broker)
  329 + Returns the last error of the broker */
  330 +PHP_FUNCTION(enchant_broker_get_error)
  331 +{
  332 + zval *broker;
  333 + enchant_broker *pbroker;
  334 + char *msg;
  335 +
  336 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
  337 + RETURN_FALSE;
  338 + }
  339 +
  340 + PHP_ENCHANT_GET_BROKER;
  341 +
  342 + msg = enchant_broker_get_error(pbroker->pbroker);
  343 + if (msg) {
  344 + RETURN_STRING((char *)msg, 1);
  345 + }
  346 + RETURN_FALSE;
  347 +}
  348 +/* }}} */
  349 +
  350 +/* {{{ proto string enchant_broker_list_dicts(resource broker)
  351 + Lists the dictionaries available for the given broker */
  352 +PHP_FUNCTION(enchant_broker_list_dicts)
  353 +{
  354 + zval *broker;
  355 + enchant_broker *pbroker;
  356 + EnchantDictDescribeFn describetozval = php_enchant_list_dicts_fn;
  357 +
  358 + char *msg;
  359 +
  360 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
  361 + RETURN_FALSE;
  362 + }
  363 +
  364 + PHP_ENCHANT_GET_BROKER;
  365 +
  366 + enchant_broker_list_dicts(pbroker->pbroker, php_enchant_list_dicts_fn, (void *)return_value);
  367 +}
  368 +/* }}} */
  369 +
  370 +/* {{{ proto resource enchant_broker_request_dict(resource broker, string tag)
  371 + create a new dictionary using tag, the non-empty language tag you wish to request
  372 + a dictionary for ("en_US", "de_DE", ...) */
  373 +PHP_FUNCTION(enchant_broker_request_dict)
  374 +{
  375 + zval *broker;
  376 + enchant_broker *pbroker;
  377 + enchant_dict *dict;
  378 + EnchantDict *d;
  379 + char *tag;
  380 + int taglen;
  381 + int pos;
  382 +
  383 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &tag, &taglen) == FAILURE) {
  384 + RETURN_FALSE;
  385 + }
  386 +
  387 + PHP_ENCHANT_GET_BROKER;
  388 +
  389 + d = enchant_broker_request_dict(pbroker->pbroker, (const char *)tag);
  390 + if (d) {
  391 + if (pbroker->dictcnt) {
  392 + pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
  393 + pos = pbroker->dictcnt++;
  394 + } else {
  395 + pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *));
  396 + pos = 0;
  397 + pbroker->dictcnt++;
  398 + }
  399 +
  400 + dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict));
  401 + dict->id = pos;
  402 + dict->pbroker = pbroker;
  403 + dict->pdict = d;
  404 + dict->prev = pos ? pbroker->dict[pos-1] : NULL;
  405 + dict->next = NULL;
  406 + pbroker->dict[pos] = dict;
  407 +
  408 + if (pos) {
  409 + pbroker->dict[pos-1]->next = dict;
  410 + }
  411 +
  412 + dict->rsrc_id = ZEND_REGISTER_RESOURCE(return_value, dict, le_enchant_dict);
  413 + zend_list_addref(pbroker->rsrc_id);
  414 + } else {
  415 + RETURN_FALSE;
  416 + }
  417 +}
  418 +/* }}} */
  419 +
  420 +/* {{{ proto resource enchant_broker_request_pwl_dict(resource broker, string filename)
  421 + creates a dictionary using a PWL file. A PWL file is personal word file one word per line. It must exist before the call.*/
  422 +PHP_FUNCTION(enchant_broker_request_pwl_dict)
  423 +{
  424 + zval *broker;
  425 + enchant_broker *pbroker;
  426 + enchant_dict *dict;
  427 + EnchantDict *d;
  428 + char *pwl;
  429 + int pwllen;
  430 + int pos;
  431 +
  432 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &pwl, &pwllen) == FAILURE) {
  433 + RETURN_FALSE;
  434 + }
  435 +
  436 + if ((PG(safe_mode) && (!php_checkuid(pwl, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(pwl TSRMLS_CC)) {
  437 + RETURN_FALSE;
  438 + }
  439 +
  440 + PHP_ENCHANT_GET_BROKER;
  441 +
  442 + d = enchant_broker_request_pwl_dict(pbroker->pbroker, (const char *)pwl);
  443 + if (d) {
  444 + if (pbroker->dictcnt) {
  445 + pos = pbroker->dictcnt++;
  446 + pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
  447 + } else {
  448 + pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *));
  449 + pos = 0;
  450 + pbroker->dictcnt++;
  451 + }
  452 + dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict));
  453 + dict->id = pos;
  454 + dict->pbroker = pbroker;
  455 + dict->pdict = d;
  456 + dict->prev = pos?pbroker->dict[pos-1]:NULL;
  457 + dict->next = NULL;
  458 + pbroker->dict[pos] = dict;
  459 + if (pos) {
  460 + pbroker->dict[pos-1]->next = dict;
  461 + }
  462 + dict->rsrc_id = ZEND_REGISTER_RESOURCE(return_value, dict, le_enchant_dict);
  463 + } else {
  464 + RETURN_FALSE;
  465 + }
  466 +}
  467 +/* }}} */
  468 +
  469 +/* {{{ proto resource enchant_broker_free_dict(resource dict)
  470 + Free the dictionary resource */
  471 +PHP_FUNCTION(enchant_broker_free_dict)
  472 +{
  473 + zval *dict;
  474 + enchant_dict *pdict;
  475 +
  476 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
  477 + RETURN_FALSE;
  478 + }
  479 +
  480 + PHP_ENCHANT_GET_DICT;
  481 +
  482 + zend_list_delete(Z_RESVAL_P(dict));
  483 + RETURN_TRUE;
  484 +}
  485 +/* }}} */
  486 +
  487 +/* {{{ proto bool enchant_broker_dict_exists(resource broker, string tag)
  488 + Wether a dictionary exists or not. Using non-empty tag */
  489 +PHP_FUNCTION(enchant_broker_dict_exists)
  490 +{
  491 + zval *broker;
  492 + char *tag;
  493 + int taglen;
  494 + enchant_broker * pbroker;
  495 +
  496 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &tag, &taglen) == FAILURE) {
  497 + RETURN_FALSE;
  498 + }
  499 +
  500 + PHP_ENCHANT_GET_BROKER;
  501 +
  502 + RETURN_BOOL(enchant_broker_dict_exists(pbroker->pbroker, tag));
  503 +}
  504 +/* }}} */
  505 +
  506 +/* {{{ proto bool enchant_broker_set_ordering(resource broker, string tag, string ordering)
  507 + Declares a preference of dictionaries to use for the language
  508 + described/referred to by 'tag'. The ordering is a comma delimited
  509 + list of provider names. As a special exception, the "*" tag can
  510 + be used as a language tag to declare a default ordering for any
  511 + language that does not explictly declare an ordering. */
  512 +
  513 +PHP_FUNCTION(enchant_broker_set_ordering)
  514 +{
  515 + zval *broker;
  516 + char *pordering;
  517 + int porderinglen;
  518 + char *ptag;
  519 + int ptaglen;
  520 + enchant_broker * pbroker;
  521 +
  522 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &broker, &ptag, &ptaglen, &pordering, &porderinglen) == FAILURE) {
  523 + RETURN_FALSE;
  524 + }
  525 +
  526 + PHP_ENCHANT_GET_BROKER;
  527 +
  528 + enchant_broker_set_ordering(pbroker->pbroker, ptag, pordering);
  529 + RETURN_TRUE;
  530 +}
  531 +/* }}} */
  532 +
  533 +/* {{{ proto array enchant_broker_describe(resource broker)
  534 + Enumerates the Enchant providers and tells you some rudimentary information about them. The same info is provided through phpinfo() */
  535 +PHP_FUNCTION(enchant_broker_describe)
  536 +{
  537 + EnchantBrokerDescribeFn describetozval = enumerate_providers_fn;
  538 + zval *broker;
  539 + enchant_broker * pbroker;
  540 +
  541 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &broker) == FAILURE) {
  542 + RETURN_FALSE;
  543 + }
  544 +
  545 + PHP_ENCHANT_GET_BROKER;
  546 +
  547 + enchant_broker_describe(pbroker->pbroker, describetozval, (void *)return_value);
  548 +}
  549 +/* }}} */
  550 +
  551 +/* {{{ proto bool enchant_dict_quick_check(resource dict, string word [, array &suggestions])
  552 + If the word is correctly spelled return true, otherwise return false, if suggestions variable
  553 + is provided, fill it with spelling alternatives. */
  554 +PHP_FUNCTION(enchant_dict_quick_check)
  555 +{
  556 + zval *dict, *sugg = NULL;
  557 + char *word;
  558 + int wordlen;
  559 + enchant_dict *pdict;
  560 +
  561 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|z/", &dict, &word, &wordlen, &sugg) == FAILURE) {
  562 + RETURN_FALSE;
  563 + }
  564 +
  565 + if (sugg) {
  566 + zval_dtor(sugg);
  567 + }
  568 +
  569 + PHP_ENCHANT_GET_DICT;
  570 +
  571 + if (enchant_dict_check(pdict->pdict, word, wordlen) > 0) {
  572 + if (!sugg && ZEND_NUM_ARGS() == 2) {
  573 + RETURN_FALSE;
  574 + }
  575 +
  576 + int n_sugg;
  577 + char **suggs;
  578 +
  579 + array_init(sugg);
  580 +
  581 + suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, (size_t *) &n_sugg);
  582 + if (suggs && n_sugg) {
  583 + int i;
  584 + for (i = 0; i < n_sugg; i++) {
  585 + add_next_index_string(sugg, suggs[i], 1);
  586 + }
  587 + enchant_dict_free_suggestions(pdict->pdict, suggs);
  588 + }
  589 +
  590 +
  591 + RETURN_FALSE;
  592 + }
  593 + RETURN_TRUE;
  594 +}
  595 +/* }}} */
  596 +
  597 +/* {{{ proto bool enchant_dict_check(resource dict, string word)
  598 + If the word is correctly spelled return true, otherwise return false */
  599 +PHP_FUNCTION(enchant_dict_check)
  600 +{
  601 + zval *dict;
  602 + char *word;
  603 + int wordlen;
  604 + enchant_dict *pdict;
  605 +
  606 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
  607 + RETURN_FALSE;
  608 + }
  609 +
  610 + PHP_ENCHANT_GET_DICT;
  611 +
  612 + RETURN_BOOL(!enchant_dict_check(pdict->pdict, word, wordlen));
  613 +}
  614 +/* }}} */
  615 +
  616 +/* {{{ proto array enchant_dict_suggest(resource dict, string word)
  617 + Will return a list of values if any of those pre-conditions are not met.*/
  618 +PHP_FUNCTION(enchant_dict_suggest)
  619 +{
  620 + zval *dict;
  621 + char *word;
  622 + int wordlen;
  623 + char **suggs;
  624 + enchant_dict *pdict;
  625 + int n_sugg;
  626 +
  627 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
  628 + RETURN_FALSE;
  629 + }
  630 +
  631 + PHP_ENCHANT_GET_DICT;
  632 +
  633 + suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, (size_t *)&n_sugg);
  634 + if (suggs && n_sugg) {
  635 + int i;
  636 +
  637 + array_init(return_value);
  638 + for (i = 0; i < n_sugg; i++) {
  639 + add_next_index_string(return_value, suggs[i], 1);
  640 + }
  641 +
  642 + enchant_dict_free_suggestions(pdict->pdict, suggs);
  643 + }
  644 +}
  645 +/* }}} */
  646 +
  647 +/* {{{ proto void enchant_dict_add_to_personal(resource dict, string word)
  648 + add 'word' to personal word list */
  649 +PHP_FUNCTION(enchant_dict_add_to_personal)
  650 +{
  651 + zval *dict;
  652 + char *word;
  653 + int wordlen;
  654 + enchant_dict *pdict;
  655 +
  656 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
  657 + RETURN_FALSE;
  658 + }
  659 +
  660 + PHP_ENCHANT_GET_DICT;
  661 +
  662 + enchant_dict_add_to_personal(pdict->pdict, word, wordlen);
  663 +}
  664 +/* }}} */
  665 +
  666 +/* {{{ proto void enchant_dict_add_to_session(resource dict, string word)
  667 + add 'word' to this spell-checking session */
  668 +PHP_FUNCTION(enchant_dict_add_to_session)
  669 +{
  670 + zval *dict;
  671 + char *word;
  672 + int wordlen;
  673 + enchant_dict *pdict;
  674 +
  675 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
  676 + RETURN_FALSE;
  677 + }
  678 +
  679 + PHP_ENCHANT_GET_DICT;
  680 +
  681 + enchant_dict_add_to_session(pdict->pdict, word, wordlen);
  682 +}
  683 +/* }}} */
  684 +
  685 +/* {{{ proto bool enchant_dict_is_in_session(resource dict, string word)
  686 + whether or not 'word' exists in this spelling-session */
  687 +PHP_FUNCTION(enchant_dict_is_in_session)
  688 +{
  689 + zval *dict;
  690 + char *word;
  691 + int wordlen;
  692 + enchant_dict *pdict;
  693 +
  694 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
  695 + RETURN_FALSE;
  696 + }
  697 +
  698 + PHP_ENCHANT_GET_DICT;
  699 +
  700 + RETURN_BOOL(enchant_dict_is_in_session(pdict->pdict, word, wordlen));
  701 +}
  702 +/* }}} */
  703 +
  704 +/* {{{ proto void enchant_dict_store_replacement(resource dict, string mis, string cor)
  705 + add a correction for 'mis' using 'cor'.
  706 + Notes that you replaced @mis with @cor, so it's possibly more likely
  707 + that future occurrences of @mis will be replaced with @cor. So it might
  708 + bump @cor up in the suggestion list.*/
  709 +PHP_FUNCTION(enchant_dict_store_replacement)
  710 +{
  711 + zval *dict;
  712 + char *mis, *cor;
  713 + int mislen, corlen;
  714 +
  715 + enchant_dict *pdict;
  716 +
  717 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &dict, &mis, &mislen, &cor, &corlen) == FAILURE) {
  718 + RETURN_FALSE;
  719 + }
  720 +
  721 + PHP_ENCHANT_GET_DICT;
  722 +
  723 + enchant_dict_store_replacement(pdict->pdict, mis, mislen, cor, corlen);
  724 +}
  725 +/* }}} */
  726 +
  727 +/* {{{ proto string enchant_dict_get_error(resource dict)
  728 + Returns the last error of the current spelling-session */
  729 +PHP_FUNCTION(enchant_dict_get_error)
  730 +{
  731 + zval *dict;
  732 + enchant_dict *pdict;
  733 + char *msg;
  734 +
  735 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
  736 + RETURN_FALSE;
  737 + }
  738 +
  739 + PHP_ENCHANT_GET_DICT;
  740 +
  741 + msg = enchant_dict_get_error(pdict->pdict);
  742 + if (msg) {
  743 + RETURN_STRING((char *)msg, 1);
  744 + }
  745 +
  746 + RETURN_FALSE;
  747 +}
  748 +/* }}} */
  749 +
  750 +/* {{{ proto array enchant_dict_describe(resource dict)
  751 + Describes an individual dictionary 'dict' */
  752 +PHP_FUNCTION(enchant_dict_describe)
  753 +{
  754 + zval *dict;
  755 + enchant_dict *pdict;
  756 +
  757 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &dict) == FAILURE) {
  758 + RETURN_FALSE;
  759 + }
  760 +
  761 + PHP_ENCHANT_GET_DICT;
  762 +
  763 + enchant_dict_describe(pdict->pdict, describe_dict_fn, (void *)return_value);
  764 +}
  765 +/* }}} */
  766 +
  767 +/*
  768 + * Local variables:
  769 + * tab-width: 4
  770 + * c-basic-offset: 4
  771 + * End:
  772 + * vim600: noet sw=4 ts=4 fdm=marker
  773 + * vim<600: noet sw=4 ts=4
  774 + */
146 ext/enchant/package.xml
... ... @@ -0,0 +1,146 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.4.8" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
  3 + <name>enchant</name>
  4 + <channel>pecl.php.net</channel>
  5 + <summary>libenchant binder, support near all spelling tools</summary>
  6 + <description>Enchant is a binder for libenchant. Libenchant provides a common
  7 +API for many spell libraries:
  8 +- aspell/pspell (intended to replace ispell)
  9 +- hspell (hebrew)
  10 +- ispell
  11 +- myspell/hunspell (OpenOffice project, mozilla)
  12 +- uspell (primarily Yiddish, Hebrew, and Eastern European languages)
  13 +A plugin system allows to add custom spell support.
  14 +see www.abisource.com/enchant/
  15 + </description>
  16 + <lead>
  17 + <name>Pierre-Alain Joye</name>
  18 + <user>pajoye</user>
  19 + <email>paj@pearfr.org</email>
  20 + <active>yes</active>
  21 + </lead>
  22 + <lead>
  23 + <name>Ilia Alshanetsky</name>
  24 + <user>iliaa</user>
  25 + <email>ilia@php.net</email>
  26 + <active>yes</active>
  27 + </lead>
  28 + <date>2006-03-21</date>
  29 + <version>
  30 + <release>1.0.1</release>
  31 + <api>1.1.0</api>
  32 + </version>
  33 + <stability>
  34 + <release>stable</release>
  35 + <api>stable</api>
  36 + </stability>
  37 + <license uri="http://www.php.net/license">PHP</license>
  38 + <notes>- add enchant_broker_list_dicts to get a list of available dictionaries
  39 +- fix compilation warnings
  40 +- add examples
  41 +- add tests</notes>
  42 + <contents>
  43 + <dir name="/">
  44 + <dir name="docs">
  45 + <dir name="examples">
  46 + <file name="example1.php" role="doc"/>
  47 + </dir>
  48 +<!-- //docs/examples -->
  49 + </dir>
  50 +<!-- //docs -->
  51 + <file name="config.m4" role="src"/>
  52 + <file name="config.w32" role="src"/>
  53 + <file name="CREDITS" role="doc"/>
  54 + <file name="enchant.c" role="src"/>
  55 + <file name="php_enchant.h" role="src"/>
  56 + <dir name="tests">
  57 + <file name="broker_describe.phpt" role="test"/>
  58 + <file name="broker_free.phpt" role="test"/>
  59 + <file name="broker_init.phpt" role="test"/>
  60 + <file name="broker_request_dict.phpt" role="test"/>
  61 + <file name="hindi_correct.txt" role="test"/>
  62 + <file name="hindi_incorrect.txt" role="test"/>
  63 + </dir>
  64 + </dir>
  65 +<!-- / -->
  66 + </contents>
  67 + <dependencies>
  68 + <required>
  69 + <php>
  70 + <min>5</min>
  71 + </php>
  72 + <pearinstaller>
  73 + <min>1.4.0b1</min>
  74 + </pearinstaller>
  75 + </required>
  76 + </dependencies>
  77 + <providesextension>enchant</providesextension>
  78 + <extsrcrelease>
  79 + <configureoption default="shared" name="with-enchant" prompt="libenchant prefix?"/>
  80 + </extsrcrelease>
  81 + <changelog>
  82 + <release>
  83 + <date>2004-08-11</date>
  84 + <version>
  85 + <release>1.0</release>
  86 + <api>1.0</api>
  87 + </version>
  88 + <stability>
  89 + <release>stable</release>
  90 + <api>stable</api>
  91 + </stability>
  92 + <license uri="http://www.php.net/license">PHP</license>
  93 + <notes>- Fixed leak inside MINFO function.
  94 +- Fixed crash inside enchant_dict_suggest() when there are no suggestions.
  95 +- Added missing safe_mode/open_basedir check inside enchant_broker_request_pwl_dict().
  96 +- Fixed various function prototypes.
  97 +- Fixed possible leak in suggestions result.
  98 + </notes>
  99 + </release>
  100 + <release>
  101 + <version>
  102 + <release>0.2.1</release>
  103 + <api>0.2.1</api>
  104 + </version>
  105 + <stability>
  106 + <release>beta</release>
  107 + <api>beta</api>
  108 + </stability>
  109 + <date>2004-03-11</date>
  110 + <license uri="http://www.php.net/license">PHP</license>
  111 + <notes>- Fix possible leak in suggestions result
  112 +- Move to beta status
  113 + </notes>
  114 + </release>
  115 + <release>
  116 + <version>
  117 + <release>0.2.0</release>
  118 + <api>0.2.0</api>
  119 + </version>
  120 + <stability>
  121 + <release>alpha</release>
  122 + <api>alpha</api>
  123 + </stability>
  124 + <date>2006-03-21</date>
  125 + <license uri="http://www.php.net/license">PHP</license>
  126 + <notes>- Add Ilia Alshanetsky as maintainer
  127 +- Cleanup sources codes (ilia)
  128 +- Add enchant_dict_quick_check (ilia)
  129 + </notes>
  130 + </release>
  131 + <release>
  132 + <version>
  133 + <release>0.1</release>
  134 + <api>0.1</api>
  135 + </version>
  136 + <stability>
  137 + <release>alpha</release>
  138 + <api>alpha</api>
  139 + </stability>
  140 + <date>2003-03-08</date>
  141 + <license uri="http://www.php.net/license">PHP</license>
  142 + <notes>Initial release
  143 + </notes>
  144 + </release>
  145 + </changelog>
  146 +</package>
83 ext/enchant/php_enchant.h
... ... @@ -0,0 +1,83 @@
  1 +/*
  2 + +----------------------------------------------------------------------+
  3 + | PHP Version 4 |
  4 + +----------------------------------------------------------------------+
  5 + | Copyright (c) 1997-2003 The PHP Group |
  6 + +----------------------------------------------------------------------+
  7 + | This source file is subject to version 3.0 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/3_0.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 + | Author: Pierre-Alain Joye <paj@pearfr.org> |
  16 + +----------------------------------------------------------------------+
  17 +
  18 + $Id$
  19 +*/
  20 +
  21 +#ifndef PHP_ENCHANT_H
  22 +#define PHP_ENCHANT_H
  23 +
  24 +extern zend_module_entry enchant_module_entry;
  25 +#define phpext_enchant_ptr &enchant_module_entry
  26 +
  27 +#define PHP_ENCHANT_VERSION "1.0.2-dev"
  28 +
  29 +#ifdef PHP_WIN32
  30 +#define PHP_ENCHANT_API __declspec(dllexport)
  31 +#else
  32 +#define PHP_ENCHANT_API
  33 +#endif
  34 +
  35 +#ifdef ZTS
  36 +#include "TSRM.h"
  37 +#endif
  38 +
  39 +static void php_enchant_broker_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
  40 +static void php_enchant_dict_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
  41 +
  42 +PHP_MINIT_FUNCTION(enchant);
  43 +PHP_MSHUTDOWN_FUNCTION(enchant);
  44 +PHP_MINFO_FUNCTION(enchant);
  45 +
  46 +PHP_FUNCTION(enchant_broker_init);
  47 +PHP_FUNCTION(enchant_broker_free);
  48 +PHP_FUNCTION(enchant_broker_get_error);
  49 +PHP_FUNCTION(enchant_broker_list_dicts);
  50 +PHP_FUNCTION(enchant_broker_request_dict);
  51 +PHP_FUNCTION(enchant_broker_request_pwl_dict);
  52 +PHP_FUNCTION(enchant_broker_free_dict);
  53 +PHP_FUNCTION(enchant_broker_dict_exists);
  54 +PHP_FUNCTION(enchant_broker_set_ordering);
  55 +PHP_FUNCTION(enchant_broker_describe);
  56 +
  57 +PHP_FUNCTION(enchant_dict_check);
  58 +PHP_FUNCTION(enchant_dict_suggest);
  59 +PHP_FUNCTION(enchant_dict_add_to_personal);
  60 +PHP_FUNCTION(enchant_dict_add_to_session);
  61 +PHP_FUNCTION(enchant_dict_is_in_session);
  62 +PHP_FUNCTION(enchant_dict_store_replacement);
  63 +PHP_FUNCTION(enchant_dict_get_error);
  64 +PHP_FUNCTION(enchant_dict_describe);
  65 +PHP_FUNCTION(enchant_dict_quick_check);
  66 +
  67 +#ifdef ZTS
  68 +#define ENCHANT_G(v) TSRMG(enchant_globals_id, zend_enchant_globals *, v)
  69 +#else
  70 +#define ENCHANT_G(v) (enchant_globals.v)
  71 +#endif
  72 +
  73 +#endif /* PHP_ENCHANT_H */
  74 +
  75 +
  76 +/*
  77 + * Local variables:
  78 + * tab-width: 4
  79 + * c-basic-offset: 4
  80 + * indent-tabs-mode: t
  81 + * End:
  82 + */
  83 +
28 ext/enchant/tests/broker_describe.phpt
... ... @@ -0,0 +1,28 @@
  1 +--TEST--
  2 +enchant_broker_describe() function
  3 +--SKIPIF--
  4 +<?php
  5 +if(!extension_loaded('enchant')) die('skip, enchant not loader');
  6 +
  7 + ?>
  8 +--FILE--
  9 +<?php
  10 +$broker = enchant_broker_init();
  11 +
  12 +if(!$broker) exit("failed, broker_init failure\n");
  13 +
  14 +$provides = enchant_broker_describe($broker);
  15 +
  16 +if (is_array($provides)) {
  17 + foreach ($provides as $backend) {
  18 + if (!(isset($backend['name']) && isset($backend['desc']) && isset($backend['file']))) {
  19 + exit("failed\n");
  20 + }
  21 + }
  22 + exit("OK\n");
  23 +} else {
  24 + echo "failed";
  25 +}
  26 +?>
  27 +--EXPECTF--
  28 +OK
21 ext/enchant/tests/broker_free.phpt
... ... @@ -0,0 +1,21 @@
  1 +--TEST--
  2 +enchant_broker_free() function
  3 +--SKIPIF--
  4 +<?php
  5 +if(!extension_loaded('enchant')) die('skip, enchant not loader');
  6 +
  7 + ?>
  8 +--FILE--
  9 +<?php
  10 +$broker = enchant_broker_init();
  11 +if (is_resource($broker)) {
  12 + echo "OK\n";
  13 + enchant_broker_free($broker);
  14 +} else {
  15 + exit("init failed\n");
  16 +}
  17 +echo "OK\n";
  18 +?>
  19 +--EXPECT--
  20 +OK
  21 +OK
15 ext/enchant/tests/broker_init.phpt
... ... @@ -0,0 +1,15 @@
  1 +--TEST--
  2 +enchant_broker_init() function
  3 +--SKIPIF--
  4 +<?php
  5 +if(!extension_loaded('enchant')) die('skip, enchant not loader');
  6 +
  7 + ?>