summaryrefslogtreecommitdiff
path: root/ext/enchant
diff options
context:
space:
mode:
authorSVN Migration <svn@php.net>2007-09-26 15:44:16 +0000
committerSVN Migration <svn@php.net>2007-09-26 15:44:16 +0000
commit0e5d551a56dffa29ebfa241c8e144064f8922714 (patch)
treedbb73b4e9ae40df898793cdb97fd10ce1cc870cb /ext/enchant
parentf871988b885179fab1399e2243fe4ea0ecbccfbe (diff)
downloadphp-git-0e5d551a56dffa29ebfa241c8e144064f8922714.tar.gz
This commit was manufactured by cvs2svn to create branch 'PHP_5_3'.
Diffstat (limited to 'ext/enchant')
-rw-r--r--ext/enchant/CREDITS2
-rwxr-xr-xext/enchant/config.m436
-rw-r--r--ext/enchant/docs/examples/example1.php25
-rw-r--r--ext/enchant/tests/broker_describe.phpt28
-rw-r--r--ext/enchant/tests/broker_free.phpt21
-rw-r--r--ext/enchant/tests/broker_init.phpt15
-rw-r--r--ext/enchant/tests/broker_request_dict.phpt31
-rw-r--r--ext/enchant/tests/hindi_correct.txt1
-rw-r--r--ext/enchant/tests/hindi_incorrect.txt1
9 files changed, 160 insertions, 0 deletions
diff --git a/ext/enchant/CREDITS b/ext/enchant/CREDITS
new file mode 100644
index 0000000000..481febbfc2
--- /dev/null
+++ b/ext/enchant/CREDITS
@@ -0,0 +1,2 @@
+enchant
+Pierre-Alain Joye, Ilia Alshanetsky
diff --git a/ext/enchant/config.m4 b/ext/enchant/config.m4
new file mode 100755
index 0000000000..b59cd8fb3c
--- /dev/null
+++ b/ext/enchant/config.m4
@@ -0,0 +1,36 @@
+dnl
+dnl $Id$
+dnl
+
+PHP_ARG_WITH(enchant,for ENCHANT support,
+[ --with-enchant[=DIR] Include enchant support.
+ GNU Aspell version 1.1.3 or higher required.])
+
+if test "$PHP_ENCHANT" != "no"; then
+ PHP_NEW_EXTENSION(enchant, enchant.c, $ext_shared)
+ if test "$PHP_ENCHANT" != "yes"; then
+ ENCHANT_SEARCH_DIRS=$PHP_ENCHANT
+ else
+ ENCHANT_SEARCH_DIRS="/usr/local /usr"
+ fi
+ for i in $ENCHANT_SEARCH_DIRS; do
+ if test -f $i/include/enchant/enchant.h; then
+ ENCHANT_DIR=$i
+ ENCHANT_INCDIR=$i/include/enchant
+ elif test -f $i/include/enchant.h; then
+ ENCHANT_DIR=$i
+ ENCHANT_INCDIR=$i/include
+ fi
+ done
+
+ if test -z "$ENCHANT_DIR"; then
+ AC_MSG_ERROR(Cannot find enchant)
+ fi
+
+ ENCHANT_LIBDIR=$ENCHANT_DIR/lib
+
+ AC_DEFINE(HAVE_ENCHANT,1,[ ])
+ PHP_SUBST(ENCHANT_SHARED_LIBADD)
+ PHP_ADD_LIBRARY_WITH_PATH(enchant, $ENCHANT_LIBDIR, ENCHANT_SHARED_LIBADD)
+ PHP_ADD_INCLUDE($ENCHANT_INCDIR)
+fi
diff --git a/ext/enchant/docs/examples/example1.php b/ext/enchant/docs/examples/example1.php
new file mode 100644
index 0000000000..9d503f74e6
--- /dev/null
+++ b/ext/enchant/docs/examples/example1.php
@@ -0,0 +1,25 @@
+<?php
+$tag = 'en_US';
+$r = enchant_broker_init();
+$bprovides = enchant_broker_describe($r);
+echo "Current broker provides the following backend(s):\n";
+print_r($bprovides);
+
+
+if (enchant_broker_dict_exists($r,$tag)) {
+ $d = enchant_broker_request_dict($r, $tag);
+ $dprovides = enchant_dict_describe($d);
+ echo "dictionary $tag provides:\n";
+ $spellerrors = enchant_dict_check($d, "soong");
+ print_r($dprovides);
+ echo "found $spellerrors spell errors\n";
+ if ($spellerrors) {
+ $suggs = enchant_dict_suggest($d, "soong");
+ echo "Suggestions for 'soong':";
+ print_r($suggs);
+ }
+ enchant_broker_free_dict($d);
+} else {
+}
+enchant_broker_free($r);
+?>
diff --git a/ext/enchant/tests/broker_describe.phpt b/ext/enchant/tests/broker_describe.phpt
new file mode 100644
index 0000000000..4c03f6f4dd
--- /dev/null
+++ b/ext/enchant/tests/broker_describe.phpt
@@ -0,0 +1,28 @@
+--TEST--
+enchant_broker_describe() function
+--SKIPIF--
+<?php
+if(!extension_loaded('enchant')) die('skip, enchant not loader');
+
+ ?>
+--FILE--
+<?php
+$broker = enchant_broker_init();
+
+if(!$broker) exit("failed, broker_init failure\n");
+
+$provides = enchant_broker_describe($broker);
+
+if (is_array($provides)) {
+ foreach ($provides as $backend) {
+ if (!(isset($backend['name']) && isset($backend['desc']) && isset($backend['file']))) {
+ exit("failed\n");
+ }
+ }
+ exit("OK\n");
+} else {
+ echo "failed";
+}
+?>
+--EXPECTF--
+OK
diff --git a/ext/enchant/tests/broker_free.phpt b/ext/enchant/tests/broker_free.phpt
new file mode 100644
index 0000000000..d00c22a974
--- /dev/null
+++ b/ext/enchant/tests/broker_free.phpt
@@ -0,0 +1,21 @@
+--TEST--
+enchant_broker_free() function
+--SKIPIF--
+<?php
+if(!extension_loaded('enchant')) die('skip, enchant not loader');
+
+ ?>
+--FILE--
+<?php
+$broker = enchant_broker_init();
+if (is_resource($broker)) {
+ echo "OK\n";
+ enchant_broker_free($broker);
+} else {
+ exit("init failed\n");
+}
+echo "OK\n";
+?>
+--EXPECT--
+OK
+OK
diff --git a/ext/enchant/tests/broker_init.phpt b/ext/enchant/tests/broker_init.phpt
new file mode 100644
index 0000000000..359a653359
--- /dev/null
+++ b/ext/enchant/tests/broker_init.phpt
@@ -0,0 +1,15 @@
+--TEST--
+enchant_broker_init() function
+--SKIPIF--
+<?php
+if(!extension_loaded('enchant')) die('skip, enchant not loader');
+
+ ?>
+--FILE--
+<?php
+$broker = enchant_broker_init();
+echo is_resource($broker) ? "OK" : "Failure";
+echo "\n";
+?>
+--EXPECT--
+OK
diff --git a/ext/enchant/tests/broker_request_dict.phpt b/ext/enchant/tests/broker_request_dict.phpt
new file mode 100644
index 0000000000..5744da6747
--- /dev/null
+++ b/ext/enchant/tests/broker_request_dict.phpt
@@ -0,0 +1,31 @@
+--TEST--
+enchant_broker_request_dict() function
+--SKIPIF--
+<?php
+if(!extension_loaded('enchant')) die('skip, enchant not loader');
+?>
+--FILE--
+<?php
+$broker = enchant_broker_init();
+if (!is_resource($broker)) {
+ exit("init failed\n");
+}
+
+$dicts = enchant_broker_list_dicts($broker);
+if (is_array($dicts)) {
+ if (count($dicts)) {
+ $dict = enchant_broker_request_dict($broker, $dicts[0]['lang_tag']);
+ if (is_resource($dict)) {
+ echo "OK\n";
+ } else {
+ echo "fail to request " . $dicts[0]['lang_tag'];
+ }
+ }
+} else {
+ exit("list dicts failed\n");
+}
+echo "OK\n";
+?>
+--EXPECT--
+OK
+OK
diff --git a/ext/enchant/tests/hindi_correct.txt b/ext/enchant/tests/hindi_correct.txt
new file mode 100644
index 0000000000..cced6b86fa
--- /dev/null
+++ b/ext/enchant/tests/hindi_correct.txt
@@ -0,0 +1 @@
+इस पृष्ठ में एक लिंक बनाने के लिये इस प्रतीक को खीचें व छोड़ें
diff --git a/ext/enchant/tests/hindi_incorrect.txt b/ext/enchant/tests/hindi_incorrect.txt
new file mode 100644
index 0000000000..1f7353c958
--- /dev/null
+++ b/ext/enchant/tests/hindi_incorrect.txt
@@ -0,0 +1 @@
+इस पृष्ठ में एक लिंक बनाने के लिये इस प्रतीक को खच व छड